public class ObjectClass {
public static void main(String[] args) {
Demo dm = new Demo();
Object obj = dm.getObject();
System.out.println("Class name :: "+obj.getClass());
System.out.println("To String " + dm.toString());
System.out.println("HashCode "+ dm.hashCode());
}
}
Output
Class name :: class newTopic.Object.Demo
To String :: newTopic.Object.Demo@2a139a55
HashCode :: 705927765
What is the difference between that Demo@2a139a55 and hascode 705927765
If you look at the Javadoc of
Object
'stoString()
, you'll see that:Hence
dm.toString()
returned: