1Z0-803 · Question #27
Given the fragment: What is the result?
The correct answer is F. 35. The two elements 3 and 4 (starting from position with index 2) are copied into position index 1 and 2 in the same array. After the arraycopy command the array looks like: {1, 3, 4, 4, 5}; Then element with index 1 is printed: 3 Then element with index 4 is printed: 5 Note:The Sys
Question
Given the fragment:
What is the result?
Exhibit
Options
- A14
- B15
- C24
- D25
- E34
- F35
How the community answered
(46 responses)- A2% (1)
- B4% (2)
- C2% (1)
- E13% (6)
- F78% (36)
Explanation
The two elements 3 and 4 (starting from position with index 2) are copied into position index 1 and 2 in the same array. After the arraycopy command the array looks like: {1, 3, 4, 4, 5}; Then element with index 1 is printed: 3 Then element with index 4 is printed: 5 Note:The System class has an arraycopy method that you can use to efficiently copy data from one array into another: public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length) The two Object arguments specify the array to copyfromand the array to copyto. The three int arguments specify the starting position in the source array, the starting position in the destination array, and the number of array elements to copy.
Topics
Community Discussion
No community discussion yet for this question.
