Home Tutorial Java Scjp Part1 SCJP Module-1 Question-3


Share on Google+Share on Google+
SCJP Module-1 Question-3
Posted on: July 6, 2010 at 12:00 AM
The program given below is from Java Arrays. It will trace your knowledge of array.

Given a sample code:

public class Sample {
public static void main(String args[]){
int[] x = new int[5];

What will happen when you compile and run the given code?

1) Compile time error
2) Compile and print 0
3) Compile and output of null
4) Compiles but gives Runtime Exception




It compiles but raise runtime exceptions (java.lang.ArrayIndexOutOfBoundsException)


Related Tags for SCJP Module-1 Question-3:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 6, 2010

Recommend the tutorial

Advertisements Advertisements