Given the code fragment:
What is the result?
A.
A NullPointerException is thrown at runtime.
B.
[1, 2, 4]
C.
[1, 2, 4, null ]
D.
[1, 3, 4, null ]
E.
[1, 3, 4 ]
F.
Compilation fails.
Given the code fragment:
What is the result?
A.
A NullPointerException is thrown at runtime.
B.
[1, 2, 4]
C.
[1, 2, 4, null ]
D.
[1, 3, 4, null ]
E.
[1, 3, 4 ]
F.
Compilation fails.
answer : B
Test B.
class ArrayList remove method takes an int as an index. Knowing like arrays index begins from 0. The element at index 2 is removed which in this case is 3.
passing null into the remove method removes first element with a null value.
B
Answer is b. why most answer in this site are wrong. do anybody know where can I get free question & answer for 808
LA B