Last active
December 15, 2019 14:29
-
-
Save kubawieczorek/252060eccb9d646da0b7b366f815aceb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car { | |
private String type; | |
private BigDecimal price; | |
public Car(String type, BigDecimal price) { | |
this.type = type; | |
this.price = price; | |
} | |
public String getType() { | |
return type; | |
} | |
public void setType(String type) { | |
this.type = type; | |
} | |
public BigDecimal getPrice() { | |
return price; | |
} | |
public void setPrice(BigDecimal price) { | |
this.price = price; | |
} | |
@Override | |
public boolean equals(Object o) { | |
if (o == this) return true; | |
if (!(o instanceof Car)) { | |
return false; | |
} | |
Car car = (Car) o; | |
return car.type.equals(type) && | |
car.price.equals(price); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment