Whenever I am trying to print hash-code of class B I am getting above mentioned errors , please tell what is wrong with my code ?
class B {
@Override
public int hashCode(){
System.out.println(this.hashCode());
//return this.hashCode();
}
}
public class Testing
{
public static void main(String[] args)
{
/*A a = new A(0, null, 1.20);
A a1 = new A(1,null,1.20);
A a3 = null;*/
B b = new B();
System.out.println(b.hashCode());
//System.out.println(a.equals(a1));
//System.out.println(a.equals(a1));
}
}
hashCode()method call itself.System.out.println(super.hashCode());? (Also, this doesn't compile because you're not returning a value).this.hashCode()in your implementation ofhashCode.