Dear all,
I am getting a typical RuntimeError in context of my program ? Can you get what that error is and why it is coming ?
One thing it is coming because there is wrong intialization in the static block.
CertkillerTe2.java
public class CertkillerTe2 {
static int[] a;
static { a[0] = 2;}
public static void main(
String[] args) { }
}
Output :
D:\>javac CertkillerTe2.java
D:\>
java CertkillerTe2
Exception in
thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at CertkillerTe2.<clinit>(CertkillerTe2.java:3)