THE EXPERT ADVISE ON JAVA
OOPS.................
Wednesday, December 31, 2008
You want to find out the value of the last element of an array. You write the following code. What will happen when you compile and run it.?
public class MyAr{
public static void main(String argv[]){
int[] i = new int[5];
System.out.println(i[5]);
}
}
1 an error at compile time
2 an error at runtime
3 The value 0 will be output
4 The string "null" will be output
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment