Q.- Given the code fragment:
public static void main(String[] args) {
ArrayList<Integer> points = new ArrayList<>();
points.add (1);
points.add (2);
points.add (3);
points.add (4);
points.add(null);
points.remove (1);
points.remove (null);
System.out.println (points);
}
What is the result?
A) [1, 3, 4, null]
B) Compilation fails.
C) [1, 2, 4, null]
D) [1, 2, 4]
E) A NullPointerException is thrown at runtime.
F) [1, 3, 4]
⧪ please give your answer in a comment section.
public static void main(String[] args) {
ArrayList<Integer>
2 Comments
b
ReplyDeleteB
ReplyDelete