Line 4 : The generic class Carpet accepts as bounded type , type B or subclass type of B (for example C). So V generic type can be B type or subclass of B type.
Line 5 : You have a generic method with generic type <X extends V>(which then applies to the argument) and return type Carpet<? extends V> :
I) So you declare the generic type of the method <X extends V>, which means X is of type B or subclass of B ( according to V parameter type i described above)
Then the <X extends V> applies to the argument of the method :
II) Carpet< ? super X> means that accepts everything that is of type X or super type of X . ( X can be B type or sublcass of B according to I) )
So merge I) and II) the argument can be only of type B. ( the argument is Carbet<B> e)
Line 5: For the return type Carpet<? extends V> means that accepts as return type every subclass of V or V , so B or subtype of B.
Joined: Jul 24, 2012
Could you give me a link to where I can fully study and understand these generic types? Also, since they are of subtype B or type B doesn't that makes them of type A as well since B extends class A?
Also, you said this "Line 5 : You have a generic method with generic type <X extends V>(which then applies to the argument) and return type Carpet<? extends V> : "
I don't quite understand it. What I know basically is you have a method and a return type. what I think you mean now is there is a method(generic method) and a return type(Carpet<? extends V>) but this generic method has a generic type( <X extends V>)? Am I correct?