It creates the integer object by auto boxing.When you create the Integer from -128 to 127 by using the above syntax, it creates the object in the constant pool like create the string in string literal pool.
If you create the Integer with the value more than 127,it creates the object in the heap.So at the time of check equality using == it returns false.
The above rule is applicable for Byte and Short also.But not applicable for Float and Double.
Here the overriding happen thru the Superclass's method.The Super class method throws Exception.So we have to handle the exception.If you try to call the method with the help of SubClass.No need to handle the exception.
By performing the operations like trim,toUpperCase,toLowerCase etc,change the state of the String,it returns the new String object.Otherwise it returs the same string object like this.So it returns true.
It doesn't override the equals method.Its just called the instance method of the class Nearly.The method returns true.
Without hashcode method also it returns true.Check that by comment the hashcode method.