class TestComparison {

    public static void main(String[] args) {
    
        int x = 5;
        int y = 6;
        int z = 5;
        float f0 = 0.0F;
        float f1 = -0.0F;
        float f2 = 5.0F;
        
        int arr1[] = {1,2,3};
        int arr2[] = {4,5,6};
        int arr3[] = arr1;
        
        String s1 = "hello";
        String s2 = "hello";
        String s3 = s1;
        String s4 = new String("hello");
           
        /** Relational ********************************************/
        System.out.println();
        System.out.println("Relational operators: ");
        System.out.println("----------------------");
        System.out.println();
        System.out.println("\t                Less than: 5 <  6 \t\t " + (x<y));        
        System.out.println("\t    Less than or equal to: 5 <= 5 \t\t " + (x<=z));
        System.out.println("\t             Greater than: 5 >  6 \t\t " + (x>y));
        System.out.println("\t Greater than or equal to: 5 >= 5 \t\t " + (x>=z));  
        System.out.println();    
        System.out.println("\t                Less than: -0.0 < 0.0  \t\t " +    
                             (f1<f0));        
        System.out.println("\t    Less than or equal to: -0.0 <= 0.0 \t\t " +
                             (f1<=f0));
        System.out.println("\t             Greater than: 5 >  NaN \t\t " +
                             (x>(f0/f1)));
                             
        /** Equality *************************************************/
        System.out.println();
        System.out.println("Equality operators: ");
        System.out.println("-------------------");
        System.out.println();
        System.out.println("\t     Equals: 5 == 5.0 \t\t " + ( x == f2));
        System.out.println("\t  Not Equal: 5 != 5.0 \t\t " + (x != f2));
        System.out.println("\t     Equals: arr1 == arr2 \t " + (arr1 == arr2) +
            " [different array objects]");
        System.out.println("\t     Equals: arr1 == arr3 \t " + (arr1 == arr3) +
            " [ref to same array object]");
        System.out.println("\t  Not Equal: arr1 != arr2 \t " + (arr1 != arr2));
        System.out.println("\t  Not Equal: arr1 != arr3 \t " + (arr1 != arr3));
        System.out.println("\t     Equals: s1 == s2 \t\t " + (s1 == s2) +
            " [same literal]");
        System.out.println("\t     Equals: s1 == s3 \t\t " + (s1 == s3) +
            " [same object reference]" );
        System.out.println("\t     Equals: s1 == s4 \t\t " + (s1 == s4) +
            " [s4 is new object]");

        /** instanceof ************************************************/
        
        String[] arr = new String[5];        
        String[] arr4 = arr;
        Object myNull = null;
        Object      o = new Object();
        
        System.out.println();
        System.out.println("instanceof operator:");
        System.out.println("--------------------");
        System.out.println();
        System.out.println("\t arr instanceof String[] \t -> " +
             (arr instanceof String[] ) );
        System.out.println("\t myNull instanceof Object \t -> " + 
             (myNull instanceof Object)  );
        System.out.println("\t arr1 instanceof int[] \t\t -> " + 
             (arr1 instanceof int[])  );
                         

    }

}