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 3 of 4.

Akash Gupta said:   1 decade ago
This is very cconfusinig,i can't satisfied with your sugesition.

Subhan said:   1 decade ago
Anybody can explain this code clearly please I can't understand

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

Palak said:   8 years ago
Thanks, @Ted.

Your explanation is very helpful to understand.

Anil said:   6 years ago
I can't understand this. Please, anyone, help me to get this.

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

Abhishek said:   9 years ago
Why D is not correct?

It also gives output as Arg is 2.

Asoka said:   1 decade ago
I think [B] is correct answer!
The same with Sundar!

Vijaya said:   7 years ago
I Am not understanding please explain correctly.

Maruthu said:   3 years ago
Very confusing, somebody please help me.


Post your comments here:

Your comments will be displayed after verification.