Multiple Choice Question

Quiz Guidelines

 

QID: 
517
Tags: 
Question: 

Given:

public class TestClass{
public static void main(String[] args){
int i = Integer.parseInt(args[1]);
System.out.println(args[i]);
}
}

What will happen when you compile and run the above program using the following command line: java TestClass 1 2

Select 1 option

A. It will print 1
B. It will print 2
C. It will print some junk value.
D. It will throw ArrayIndexOutOfBoundsException.
E. It will throw NumberFormatException

Q&A Set: