public class Account { private String name; private long id; public Account(String name, long id) { this.name = name; this.id = id; } public long getId() { return this.id; } public boolean equals(Object obj) { if (obj == null) { return false; } if (this.getClass() != obj.getClass()) { return false; } Account other; other = (Account) obj; if (id != other.id) { return false; } if (name == null && other.name != null) { return false; } return name.equals(other.name); } public String toString() { return "Account: {name="+name+", id="+id+"}"; } }