Home  >  Forum  >  Core Java
Post New Query

example of hasCode() method in java

joined on
February 03,2015
Asked on March 22,2015
example of hasCode()  method in java
joined on
October 10,2013
Replied on March 22,2015

hashCode() and equals() method has been defined in java Object class with default implementation and is used together. When we create our class we can override these two methods. The use of these two methods is to check duplicate object among objects. Two object is same only if hashCode() and equals() methods both are same. Find the example

joined on
March 15,2013
Replied on March 29,2015

// hashCode test- prints out a hashcode for the abject(a unique id)

public class Tiger {
public static void main(String[] args) {
Tiger t = new Tiger();


Write Answer

Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us