Wednesday 20 July 2016

How to get hash code of the object:

How to get hash code of the object:
===========================
In java every object contains some unique number called hash code and it allocated to object by JVM.
In order to get hash code of the object ,Object (java. Lang package) class is having one method called hash Code().
Public int hashCode();
Whenever call hash Code() method we will get hash code of the particular object.

//Example on how to get hash code of the object
public class HashCode {

       @Test
       public void script() throws InterruptedException {
             
              WebDriver driver = new FirefoxDriver();
              driver.get("http://rameshselenium.blogspot.in/2016/02/fillo-api.html");
             
              //getting hashcode of the driver object
              int hashCode = driver.hashCode();
              System.out.println("hash code of the object is : " +hashCode());
              driver.quit();      
       }
}


No comments:

Post a Comment