Conditional Operator

Lesson Progress
0% Complete

Example Code

public class ConditionalOperatorExample {

	public static void main(String[] args) {
		// conditional operator &&, ||
		int x = 10;
		int y = 20;
		int z = 30;
		if (x < y && y < z)
			System.out.println("greatest" + z);
		if (x < y || y < z)
			System.out.println("greatest" + z);
	}
}