if-else statements control the flow of your program by executing different code blocks based on conditions.
Source Code
public class IfElseExample {
public static void main(String[] args) {
int number = 10;
if (number > 0) {
System.out.println("Number is positive.");
} else {
System.out.println("Number is not positive.");
}
}
}