Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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 {}


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: