public class MyClass
{
    public static boolean isEqual(Object obj1, Object obj2)
    {
        return obj1==obj2;
    }
    public static void main(String args[])
    {
        //output: true
        System.out.println(2.2f==2.2f);
        //output: false
        System.out.println(isEqual(2.2f,2.2f));
        //output: true
        System.out.println(22L==22L);
        //output: true
        System.out.println(isEqual(22L,22L));
    }
}
All of the following print statements except the second output true. Why is this so? The method isEqual() call for two integer literals outputs true yet the call for two floating point literals outputs false, but why? And why does this operates differently from the regular == comparison?
 
    