// COperators.java /** * Program to demonstrate the Comparison Operators * */ class COperators{ public static void main(String [] arg){ boolean result; int xInt = 4, yInt = 5; double aDouble = 3.14; result = xInt < yInt; System.out.println(xInt + " < " + yInt + " ---> " + result ); result = aDouble >= xInt; System.out.println(aDouble + " >= " + xInt + " ----> " + result); result = 1 > -3 + 24; System.out.println("1 > -3 + 24 ----> " + result); result = 123 != 34; System.out.println("123 != 34 " + result); result = 25 == 4*6*1*1 + 1; System.out.println("25 == 4*6*1*1 + 1 ----> " + result); System.out.println("\n\n"); if(xInt < yInt) System.out.println("Its smaller "); else System.out.println("It's not smaller"); System.out.println("End first if-else"); System.out.println(); int a = 4, b = 4; if(a != b) System.out.println("They are not equal"); else System.out.println("They are equal"); System.out.println("End second if-else"); System.out.println(); // remove the comment below. /* result = xInt = 4; System.out.println("xInt = 4 ---> " + result); */ // What went wrong ? // Put the comments back above and try the one below /* result = 6 < 9 < 12; System.out.prinln("6 is less than 9 and 9 is less than 12 " + result); */ } }