Comment by weksf54
3 months ago
You could use Java records to make things more concise:
record Truck(int loadCapacity) implements Vehicle {}
record Car(int numberOfSeats, String brandName) implements Vehicle {}
sealed interface Vehicle permits Car, Truck {}
No comments yet
Contribute on Hacker News ↗