class A {} class B extends A{} class C extends B{} public class Test { public List<? extends B> ring(){ // line 1 } }
class B extends A{}
class C extends B{}
public class Test {
public List<? extends B> ring(){
// line 1
}
A non generic List can be returned but a warning is caused at run time.
? is never used at instantiation.
The return type is a List, so ArrayList and LinkedList are valid returns.
Oracle Certified Professional Java Programmer
Access: Public Instant Grading
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use.