Twins

 avatar
unknown
java
2 years ago
478 B
6
Indexable
public boolean equals(Person person) {
		// jei nuorodos i vienoda - adresa objektas tas pats
		System.out.println("cia");
		if (this == person) {
			System.out.println("Same!");
			return true;
		}

		if (!(person instanceof Person)) {
			return false;
		};

		if (!this.birthday.equals(person.birthday)) {
			return false;
		}
		
		if(this.name != person.name && 
		 this.height != person.height &&
		 this.weight != person.weight) {
			return false;
		}
		
		return true;

	}
Editor is loading...