SHARE
TWEET

Untitled

IlushaBeletskiy Dec 15th, 2019 (edited) 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Test {
  2.  
  3.     private int id;
  4.     private int age;
  5.  
  6.     public Test(int id, int age) {
  7.         this.id = id;
  8.         this.age = age;
  9.     }
  10.  
  11.     public boolean equals(Object o) {
  12.         Test otherTest = (Test) o;
  13.         return otherTest.id == this.id;
  14.     }
  15.    
  16.     public String toString() {
  17.         return "айди  - " + this.id;
  18.     }
  19.  
  20.     @Override
  21.     public int hashCode() {
  22.         return this.id * 12345;
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top