Exam Permalink:
https://www.jobilize.com/java-certification-questions
Question Permalink:
https://www.jobilize.com/how-to-declare-a-generic-collection-in-java
Question 210 / 297:  How can this program be modified to make use of appropriate generic types? (one modification for each line)
Choose 3
import java.util.*;

public class Test {

public static void main(String[] args) {

List ids = new ArrayList(); // Line 1

ids.add(123);

ids.add(999);

Map students = new HashMap(); // Line 2

students.put("Jess",ids.get(0));

students.put("Jimmy",ids.get(1));

int x = ((Long)students.get("Jimmy")).intValue(); // Line 3

}

}

<< First < Previous Next > Last >>
Exam Home Page
https://www.jobilize.com/java-certification-questions

Oracle Certified Professional Java Programmer

Author:

Access: Public Instant Grading

Ask
Michael Sag
Start Exam
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>