Wednesday, 3 February 2016

Java Tutorial : Java Object Class(hashCode method)


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) 
Employee.java
public class Employee
{
    private String name;
}
ObjectClassTest.java
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());

    }

}
Output
employeeObj1.hashCode() = 1704856573
employeeObj2.hashCode() = 705927765
Click the below link to download the code:
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:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment