Examveda

What will be the output of the following Java 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"

Answer: Option A


This Question Belongs to Java Program >> Miscellaneous In Java

Join The Discussion

Related Questions on Miscellaneous in Java