Kotlinlearncs.online LogoJava
Return to List

Solve: Car Equality

Created By: Geoffrey Challen
/ Version: 2021.2.0

Define a public class named Car. The Car constructor should accept a String make, String model, and int mileage, in that order. Reject null makes and models using assert. Override equals and consider two Car instances to be equal if they have the same make and model. Do not provide getters or setters for your variables or expose them publicly.

Related Lessons

Stuck? You may find these lessons helpful: