extends
keyword means that the class on the left of this keyword would be using all the methods and properties from the class that is one the right side. ?
wouldn't be there. Some name would be. A name of a class.
static ArrayList<? extends A> list = new ArrayList<A>();
In the above code, you're making a new ArrayList
object which uses (implements/extends) the Class A
for its methods and properties but is not in real A
.
static ArrayList<A> list = new ArrayList<A>();
Whereas in the second code that you usually use, you're actually creating an Object which uses class A
in real.
In Java we call it inheritance where one class inherits all the properties and functions of the other class.
http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html