Katrin
SCJP 5.0, SCWCD, SCBCD, Oracle Certified Master Enterprise Architect
SCJP 5.0 | SCWCD 1.4
By List<? extends Animal> we're saying: " I can be assigned a collection that a subtype of List and typed for<Animal> or anything extends Animal. And oh yes, I SWEAR that will not ADD anything into the collection."
SCJP 5.0 | SCWCD 1.4
SCJP 5.0 | SCWCD 1.4
When I tried this, providing Shape isn't an abstract class, both draw functions behaved exactly the same.
all events occur in real time
When you use the < ? super ...> syntax, you are telling the compiler that you can accept the type on the right hand side of super or any of it supertypes, ...
all events occur in real time
Katrin
SCJP 5.0, SCWCD, SCBCD, Oracle Certified Master Enterprise Architect
all events occur in real time
A List<? super String> may contain lists of type String and any higher type.
But you can add directly only Strings, nothing higher.
SCJP 5.0 | SCWCD 1.4
Katrin
SCJP 5.0, SCWCD, SCBCD, Oracle Certified Master Enterprise Architect
Oh the stink of it! Smell my tiny ad!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|