private int age; public UserInfo(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String toString() { return "UserInfo(name=" + this.name + ", age=" + this.age + ")"; } public int hashCode() { return (this.name != null?this.name.hashCode():0) * 31 + this.age; } public boolean equals(Object var1) { if (obj == this) return true; if (!(obj instanceof UserInfo)) { return false; } UserInfo userInfo = (UserInfo) obj; return userInfo.name.equals(name) && userInfo.age == age; } } ౣܽ যڌѱ ਊೡө? thdev.tech, 2017 33