package net.dharmaraj;
public class Base {
int array[] = new int[3];
private void test() {
System.out.println("Value is: " + array[0]);
}
static public void main(String[] a) {
new Base().test();
}
}
will be the output when you compile and execute the following program.
Select most appropriate answer.
a) Compile time error. Variable array may not have been initialized.
b) Runtime error. Variable array[0] may not have been initialized.
c) Runtime error. java.lang.NullPointerException at line No 6
d) Value is: 0
Ans : d
Output:-
Value is: 0
No comments:
Post a Comment