Oops, sorry for adding in extra syntax and features.
ArrayList<Drivable> myVehicles = new ArrayList<Drivable>();
Drivable is an interface. This declares an ArrayList which can hold anything...
Type: Posts; User: helloworld922
Oops, sorry for adding in extra syntax and features.
ArrayList<Drivable> myVehicles = new ArrayList<Drivable>();
Drivable is an interface. This declares an ArrayList which can hold anything...
For a single class interfaces aren't terribly useful, and you're right that it looks just like unnecessary overhead/boilerplate code.
However, consider a few different classes:
Car, Truck,...