Is the parameterized interface List<Bicycle> a subinterface of List<Vehicle> ? Explain briefly.
No. The List interface is defined for generic types and the defined methods do not change for various type parameters. That is to say, List<x> has the same methods for any x.
Your issues are:
- I thought you couldn't even have lists in interfaces, only methods.
- How can a list be an interface, let alone a subinterface?
- What is this question even asking, in plain English? :/
My answers are:
- An interface can have fields (Math.PI), methods, and member classes (SomeParcel.Build). A method can have List as the return type, so a List can be in an interface (e.g Arrays.asList() ).
- List is only an interface. It is a subinterface of Collection and Iterator because List's superinterfaces are Collection and Iterator. In other words, List has all the methods of the superinterface Collection and more, therefore it is a subinterface of Collection.
- Does List<Bicycle> have more methods than List<Vehicle>?
I may be wrong, so I don't mind if someone wants to teach me about the finer nuances of Java terminology.