Question 90 / 297:  What is the result of compiling and running the following program?
public class Tester {

final static int x[] = new int[5];

public static void main(String[] args) {

final int x = new Tester().x[5];

if (x <= 10)

System.out.println("javachamp");

}

}

A  Compilation error
B  ArrayIndexOutOfBoundsException is thrown
C  javachamp
D  No output is produced
<< First < Previous Next > Last >>
Explanation:

Allowed indexes for array x are from 0 to 4, else ArrayIndexOutOfBoundsException is thrown

Exam Home Page
Ask
Michael Sag
Start Exam
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>