Single Choice Not Set

QWhat will be the output of the program?
public class CommandArgsThree 
{
    public static void main(String [] args) 
    {
        String [][] argCopy = new String[2][2];
        int x;
        argCopy[0] = args;
        x = argCopy[0].length;
        for (int y = 0; y < x; y++) 
        {
            System.out.print(" " + argCopy[0][y]);
        }
    }
}
What will be the output of the program? public class CommandArgsThree { publ

ID: #1994 Java Language Fundamental 2,515 views
Question Info
#1994Q ID
Not SetDifficulty
Java Language FundamentalTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 0 0
  • B 1 2
  • C 0 0 0
  • D 1 2 3
Correct Answer

Explanation

In argCopy[0] = args;, the reference variable argCopy[0], which was referring to an array with two elements, is reassigned to an array (args) with three elements.

Share This Question

Challenge a friend or share with your study group.