[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

JAVA Programming :: Objects and Classes - Discussion

Home > JAVA Programming > Objects and Classes > MCQs Questions Discussion

28 / 30

Choose the correct option.

What gets printed when the following code is compiled and run with the following command –
java test 2
Select the one correct answer.

public class test {
public static void main(String args[]) {
Integer intObj=Integer.valueOf(args[args.length–1]);
inti = intObj.intValue();
if(args.length> 1)
System.out.println(i);
if(args.length> 0)
System.out.println(i – 1);
else
System.out.println(i – 2);
}
}

A    test

B    test -1

C    0

D   1

E    2

Answer: Option (Login/Signup)

Show Explanation

Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here