if-else-if Statement (Selection Statement)

Using if-else if-if again to check number is negative. positive, or zero.

Example Code

public class IF_Else_If_Example {
	public static void main(String[] args) {
		int number = 0;
		if (number > 0) {
			System.out.println("positive number");
		}
		else if (number < 0) {
			System.out.println("negative number");
		} else {
			System.out.println("number is 0");
		}
	}
}