Pre-Requisites: ITE Will Be Able To
Pre-Requisites: ITE Will Be Able To
2152
• Number of credits: 2 Pre-requisites: ITE
1122
• On successful learning of this module you
will be able to:
1. Use mobile development environment
to effectively develop mobile
applications.
2. Develop moderately complex mobile
applications for contemporary mobile operating
systems.
Assessment
Plan
Assessment Method Description Weight
Continuous Assessment Take Home 10%
Assignment 01
Discussion forums 5%
Take Home 20%
Assignment 02
Quiz 5%
Exam 60%
Required
Readings
1. Beginning Android Programming with
Android Studio. J. F. DiMarzio (2016)
Ex:
type variable_name;
type variable_name,
variable_name,variable_name;
Declare
1/14/2020 26
Rules of variable naming in Java
• Should not begins with a digit.
• Case sensitive.
• If the data types are compatible, then Java will perform the
conversion automatically known as Automatic Type
Conversion and if not then they need to be casted or
converted explicitly.
• Example
Size 4 byte
int b =300;
byte i = b; // won’t
compile
Size 1 byte
🠜a = +b is equivalent to a = b
importjava.util.Scanner;
• use scanner function to get keyboard inputs
public String next() It returns the next token from the scanner.
num2=65;
{ int num1,num2;
Scanner user_input= new
Scanner(System.in);
•
if is in lowercase letters. Uppercase letters (If or
IF) will generate an error.
else
if (condition) Statement
{
// block of code to be executed if the
condition
is true
} else
{
// block of code to be executed if the
condition
is false
}
else if
if (condition1) { Statement
// block of code to be executed if condition1 is
true
} else if (condition2) {
// block of code to be executed if the condition1
is false and condition2 is true
} else {
// block of code to be executed if the condition1 is
false and condition2 is false
}
Switch
Statements
switch(expression) {
case x:
// code block
break;
case y:
// code block
break;
default :
// code block
}
Switch Statements
Contd.
This is how it works:
• The switch expression is evaluated once.
• The value of the expression is compared with
the values of each case.
• If there is a match, the associated block of code
is executed.
• The break and default keywords are optional,
and will be described later in this chapter
Questio
n
• Write a Java program to get a number from the
user and print whether it is positive or
negative.
Questio
n
• Write a Java program to find the number of days
in a month when user input month and year.
Loops
• Loops can execute a block of code as long as
a specified condition is reached.
• Types of Loops
1. For loop
2. While loop
3. Do While loop
For
ForLoop
loop executes a set of statements repeatedly until
a specified condition evaluates to false.
FOR LOOP has 3
parts
• Initialization
• Condition
• arr[0] = 1;
• asrr[1]=2;
• int arr[]={1,2,3,4,5,6};
• arr.length
for(int i=0;i<a.length;i++){
System.out.println( arr[i] );
}
Questio
•
n
Write a Java program to find the count of even and odd integers
in the array of integers.
number_Array = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Answer
Questio
n
Define an array to store Marks of 5 students entered by the
user. Write a complete java program to do following task.