Which command-line arguments should you pass to the program to obtain the following output?

Given the code snippet from a compiled Java source file:

Which command-line arguments should you pass to the program to obtain the following output?
Arg is 2
A. java MyFile 1 3 2 2
B. java MyFile 2 2 2
C. java MyFile 1 2 2 3 4
D. java MyFile 0 1 2 3

Download Printable PDF. VALID exam to help you PASS.

One thought on “Which command-line arguments should you pass to the program to obtain the following output?

  1. A:

    # javac MyFile.java
    # java MyFile 1 3 2 2
    Arg is 2

    ————————–
    1 is args [0], 3 is args [1], 2 is args[2], 2 is args[3]

    12

Leave a Reply

Your email address will not be published. Required fields are marked *