Question 203 / 297:  Considering that all needed imports are there, what, inserted independently at line 1, will compile?
Choose 4
class A {}

class B extends A{}

class C extends B{}

public class Test {

public List<? extends B> ring(){

// line 1

}

}

<< First < Previous Next > Last >>
Explanation:

<? extends B> means B and any type that subType of B, which in this case is C.

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.

Exam Home Page
Ask
Subramanian Divya
Start Quiz
Stephanie Redfern
Start Quiz
Edgar Delgado
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>