The difference between extends and super

Source: http://bbs.csdn.net/topics/380150197
Comment:
First observe the difference between extends and super
Java code

class A{}
class B extends A{}
class C extends B{}
List<? extends B> a = new ArrayList<C>();
List<? super B> b = new ArrayList<A>();


extends must be itself or subclass
super must be itself or superclass

extends is the upper bound of the following class
super is Take the following class as the lower bound

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326260785&siteId=291194637