Difficulty: Easy
Correct Answer: 1 2 3
Explanation:
Introduction / Context:
The snippet checks understanding of Java arrays, references, and command-line arguments. Assigning argCopy[0] = args makes the first row reference the same one-dimensional array that holds all command-line strings, so iterating over argCopy[0] effectively iterates over args.
Given Data / Assumptions:
Concept / Approach:
Because argCopy[0] is aliased to args, argCopy[0][y] equals args[y]. The loop prints each element with a leading space, producing “ 1 2 3”. MCQ options ignore the leading spaces and focus on tokens 1, 2, 3.
Step-by-Step Solution:
Verification / Alternative check:
Printing argCopy[0] using Arrays.toString would show the same elements since both references point to the same backing array.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming argCopy[0] = args copies elements; it only reassigns the reference.
Final Answer:
1 2 3
Discussion & Comments