import java.util.Scanner; import java.io.*; /** Oct 10 teaches the conditional operator */ public class Conditional { public static void main(String[] args) { // replaces if stmt // for eg. I want to print larger of 2 numbers int num1 = 19, num2 = 20; int max; if (num1 > num2) max = num1; else max = num2; // do exactly the same thing using the conditional operator max = num1 > num2 ? num1 : num2; System.out.println("max is: " + max); } }