/
ValentinaE
/
HashMap
Обзор
Документация
Войти
/
ValentinaE
/
HashMap
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Address.java
49 строк
1 KB
ValentinaE
upload files
25 фев 2025, 15:46
25 фев 2025, 15:46
ee0d615
Код
Авторство
О чём код?
import java.util.Objects; public class Address { private String country; private String city; public Address(String country, String city) { this.country = country; this.city = city; } public String getCountry() { return country; } public String getCity() { return city; } public void setCountry(String country) { this.country = country; } public void setCity(String city) { this.city = city; } @Override public String toString() { return "Address{" + "country -'" + country + '\'' + ", city -'" + city + '\'' + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Address address = (Address) o; return Objects.equals(country, address.country) && Objects.equals(city, address.city); } @Override public int hashCode() { return Objects.hash(country, city); } }