Given the code fragment: What is the result?
A.
Compilation fails.
B.
An ArrayoutofBoundsException is thrown at runtime.
C.
1:2:3:
D.
1:2:3:4:5:
Given the code fragment: What is the result?
A.
Compilation fails.
B.
An ArrayoutofBoundsException is thrown at runtime.
C.
1:2:3:
D.
1:2:3:4:5:
d
right
Definitely D.
Why not array index out of bounds
Because you are copy the references of the objects nums2 to nums1.
Anyone has other dumps avaible ?
B
Answer: D
output:
1:2:3:4:5:
d
D tutta la vita
Answer correct D!
With the following instruction: num1=num2, you are copying the references num2 into num1.
1)
num1 –> new int[2]
num2 –> 1 2 3 4 5
*** num1 = num2 ***
2)
num1 –> 1 2 3 4 5
num2 –> 1 2 3 4 5