adplus-dvertising
frame-decoration

Question

What would be the output of following snippet, if compiled and executed with command line argument “java abc 1 2 3”?
public class abc
{
   static public void main(String [] xyz)
   {
       for(int n=1;n<xyz.length; n++)
       {
          System.out.println(xyz[n]+"");
       }
   }
}

a.

1 2

b.

2 3

c.

1 2 3

d.

Compilation error

Posted under Java Programming

Answer: (b).2 3

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What would be the output of following snippet, if compiled and executed with command line argument “java abc 1 2 3”?