adplus-dvertising
frame-decoration

Question

What would be the output of the following snippet, if compiled and executed with command line “hello there”?
public class abc
{
String[] xyz;
 
public static void main(String argv[])
{
xyz=argv;
}
 
public void runMethod()
{
System.out.println(argv[1]);
}
}

a.

Compile time error

b.

Output would be “hello”

c.

Output would be “there”

d.

Output would be “hello there”

Posted under Java Programming

Answer: (a).Compile time error

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 the following snippet, if compiled and executed with command line “hello there”?