
public class DecisionConstruct {

	public static void main(String[] args) {

		int x = 5;

		// if statement
		if (x == 5) {
			System.out.println("x is 5");
		}

		// if-else statement
		if (x == 5) {
			System.out.println("x is 5");
		} else {
			System.out.println("x is " + x);
		}

		// if-else if-else statement
		if (x < 5) {
			System.out.println("x is less than 5");
		} else if (x > 5) {
			System.out.println("x is greater than 5");
		} else {
			System.out.println("x is " + x);
		}

		// nested if
		if (x <= 5) { // outer if
			if (x < 0) { // inner if
				System.out.println("x is a negative value: " + x);
			} else {
				System.out.println("x is a positive value: " + x);
			} // end of inner if
		} else {
			System.out.println("x is greater than 5: " + x);
		} // end of outer if

		// switch statement
		char color = 'G';
		switch (color) {
		case 'R':
			System.out.println("Red");
			break;
		case 'G':
			System.out.println("Green");
			break;
		case 'B':
			System.out.println("Blue");
			break;
		default:
			System.out.println("Unknown");
		}
		System.out.println("The end.");
	}

}
