Question 79 / 297:  What is the result of compiling and running the following program using JDK 1.5 or higher?
import java.util.ArrayList;

import java.util.List;

interface chewable {}

class Gum implements chewable {}

public class Tester {

public static void main(String[] args) {

List<Gum> list1 = new ArrayList<Gum>();

list1.add(new Gum());

List list2 = list1;

list2.add(new Integer(9));

System.out.println(list2.size());

}

}

A  Compilation error
B  2 will be printed but with warnings
C  2 will be printed without warnings
D  An exception will be thrown at runtime
<< First < Previous Next > Last >>
Exam Home Page
Ask
Yacoub Jayoghli
Start Quiz
Madison Christian
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>