0
How to generate hashCode () and equals () method
Helle beautiful people of Sololearn, Ahen I tey to generate the hashcode () and equals () method, it comes with the error: "There are non-static fields in the class" What do I have to do to generate the methods? here is the code: class Apples { public static void main (String [] args) { // Some code I didn't put in yet } } kind regards, Tom Post
3 Respostas
+ 1
hi...
just follow the steps as stated in the tutorial i.e. "Just right click in your class, go to Source->Generate hashCode() and equals()..."
i hope this helps your question, if not, let us know...
0
You have to instantiate and Apples object
With that object you already can make use of equal and hascode methods because this are defined in object superclass
Or you can override those methods in your Apples class
0
Well.....
Considering this was 3 months ago...