If return type of toString is String but it also return a hashcode and hashcode method return type is int. when i print the reference of any user define class object. if user define class has not toString overide method . for example: Myclass c=new Myclass(); System.out.println( c ); // output Myclass@hashcodenumbers Any can inform me that how it is happend. ------------------
Nain Hwu
Ranch Hand
Joined: Sep 16, 2001
Posts: 139
posted
0
Take a look at the toString() method for Object class. It says:
this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashcode())