Java Topics With Examples
Java Topics With Examples
3. If-else statements
int number = 10;
if(number % 2 == 0) {
System.out.println("Even number");
} else {
System.out.println("Odd number");
}
// While loop
int j = 1;
while(j <= 5) {
System.out.println(j);
j++;
}