When launched, my program immediately throws an ExceptionInInitializerError. Source from this method:
public static void errorMessage(String input) {
System.err.println("[ERROR] " + form.format(date) + " - " + Thread.currentThread().getStackTrace()[3].getClassName() + ": " + input);
}
I printed different parts of the line and found that the error only occurs when form.format (date) is called. He says that it is zero. The only problem is that both the date and the form are statically declared directly above this method:
public static Date date = new Date();
public static DateFormat form = new SimpleDateFormat("HH:mm:ss");
The error was suddenly launched after a small bug fix. I have no idea what is wrong or how something is wrong with this. I mean, I am invoking statically declared variables in the same class. Technically, they should not be zero, but they are. Anyone have any ideas why he is throwing this error? Here is the console output:
java.lang.ExceptionInInitializerError
at A$$OpSystem.getOperatingSystem(A$.java:98)
at A_.<clinit>(A_.java:19)
Caused by: java.lang.NullPointerException
at A$.errorMessage(A$.java:72)
at A$.loadCursor(A$.java:84)
at A$.<clinit>(A$.java:62)
... 2 more
Exception in thread "main"
, A $.OpSystem.getOperatingSystem , A $.errorMessage...
, , , . , . , . ?
, , ...
EDIT: , , Cursor, "loadCursor" . ?
, ?
public class StaticMethodTesting {
public static int i = getInt();
public static int getInt() {
return getAnotherInt();
}
public static int getAnotherInt() {
return 0;
}
public static void main(String[]args) {
System.out.println("Hi");
}
}