public class Test {
public static void main(String args[]) {
int i = 10;
Integer a = new Integer(i);
System.out.println(a); //tostring method overriden
System.out.println(a.hashCode());
}
}
Output:
10
10
now my question is why hashCode()
method is overriden in this case.
If I want to find the object reference of the wrapper class object a in the above code.
How do i do it?