Java Programming - Java.lang Class - Discussion

Discussion Forum : Java.lang Class - General Questions (Q.No. 4)
4.
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
java Myfile 222
java Myfile 1 2 2 3 4
java Myfile 1 3 2 2
java Myfile 0 1 2 3
Answer: Option
Explanation:

Arguments start at array element 0 so the fourth arguement must be 2 to produce the correct output.

Discussion:
33 comments Page 4 of 4.

Abhijit said:   1 decade ago
args[0]=1,args[1]=3,args[2]=2,args[3]=3 and hence rip=args[3]=3

Sathish said:   1 decade ago
I can't understanding this concept please any one help me.

Nijin said:   1 decade ago
Can anybody help me understanding this?


Post your comments here:

Your comments will be displayed after verification.