I guess that, if the equals()
test returns false, x and y can't possibly refer to the same object so x==y returns false.
If i am right then why in the following program the output turnsout to be "EQ".
Can anybody explain me.
1 public void testC(char ch) {
2 Integer ss = new Integer( ch );
3 Character cc = new Character( ch ) ;
4 if( ss.equals( cc )) System.out.println("equals");
5 if( ss.intValue() == cc.charValue() ){
6 System.out.println("EQ");
7 }
8 }
I know that the equals test fails when the objects are of different types