What is the output of the following when run as java MyClass 1 2?
public class MyClass { public static void main(String target[]) { System.out.println(target.length()); } }
D.
Arrays expose a length variable.
They do not have a length()
method.
Therefore, the code does not compile, and Option D is correct.