What is the output of the following when run as java Main "1 2"?
public class Main { public static void main(String target[]) { System.out.println(target.length); } }
B.
The name of the program is Main, and there is only one argument because double quotes are used around the value.
That argument is a String with three characters: 1, a space, and 2.
Therefore, the program outputs 1, and Option B is correct.