if else expression in java code example
Example 1: how to make if else statments in java
if (condition) {
// code block
} else {
// code block
}
Example 2: if else java
public class TestIfElse {
public static void main(String[] args) {
int a = 5, b = 6;
if (a > b) {
System.out.println("a is greater");
} else {
System.out.println("b is greater");
}
}
}