Oracle
1Z0-809 · Question #171
1Z0-809 Question #171: Real Exam Question with Answer & Explanation
The correct answer is B. java MyFile 1 3 2 2. See the full explanation below for the reasoning.
Question
Given the code snippet from a compiled Java source file:
public class MyFile {
public static void main(String[] args) {
String arg1 = args[1];
String arg2 = args[2];
String arg3 = args[3];
System.out.println("Arg is " + arg3);
}
}
Which command-line arguments should you pass to the program to obtain the following output?
Arg is 2Options
- Ajava MyFile 0 1 2 3
- Bjava MyFile 1 3 2 2
- Cjava MyFile 1 2 2 3 4
- Djava MyFile 2 1 2
Community Discussion
No community discussion yet for this question.