205k views
5 votes
public class Myfile { public static void main (String[] args) { String biz = args[1]; String baz = args[2]; String rip = args[3]; System.out.println("Arg is " + rip); } } Select how you would start the program to cause it to print: Arg is 2 A. java Myfile 222 B. java Myfile 1 2 2 3 4 C. java Myfile 1 3 2 2 D. java Myfile 0 1 2 3

1 Answer

4 votes

Answer:

java MyFile 1 3 2 2

Step-by-step explanation:

Option is is the correct answer, whatever we pass as commadD line arguments can be accessed using String array args by passing index

Array indexes starts with zero, in our case when we say

java MyFile 1 3 2 2

its going to be store like args[0] = 1, args[1] = 3, args[2] = 2, args[3] = 2

now we are saying System.out.println("Arg is " + rip);

it means its going to print Args is with value of rip i.e. 2 (rip=args[3])

User Bob Palmer
by
5.0k points