Click here to watch in Youtube :
https://www.youtube.com/watch?v=NmcG8LRkxIU&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Object Class(hashCode method) |
public class Employee
{
private String name;
}
public class ObjectClassTest { public static void main(String[] args) { Employee employeeObj1 = new Employee(); /* * Returns a hash code value for the object, which * is the object's memory address in hexadecimal. */ System.out.println("employeeObj1.hashCode() = " + employeeObj1.hashCode()); Employee employeeObj2 = new Employee(); System.out.println("employeeObj2.hashCode() = " + employeeObj2.hashCode()); } }
employeeObj1.hashCode() = 1704856573 employeeObj2.hashCode() = 705927765
https://sites.google.com/site/javaee4321/java/ObjectClassDemo_hashCode_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ObjectClassDemo_hashCode_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/8fa82bcbf36a8ef675302adced6f7a0764627bd4/BasicJava/ObjectClassDemo_hashCode_App/?at=master
See also:
No comments:
Post a Comment