Multiple Choice Question

Quiz Guidelines

 

QID: 
23
Validated against: 
java8
Question: 

What will be the result of trying to compile and execute of the following program?

public class TestClass{

public static void main(String args[] ){

int i = 0 ;

int[] iA = {10, 20} ;

iA[i] = i = 40 ;

System.out.println(""+ iA[ 0 ] + " " + iA[ 1 ] + " "+i) ;

}

}

Select 1 option

A. It will throw ArrayIndexOutofBoundsException at Runtime.

B. Compile time Error.

C. It will prints 10 20 40

D. It will prints 40 20 40

E. It will prints 0 20 40

Q&A Set: