So, I've got code that compiles fine, but gives a NullPointerException error when I try to run it. Specifically, it says:
Exception in thread "main" java.lang.NullPointerException
at mrchen.ButtonDrawPanel.<init>(rktest.java:884)
at mrchen.rktest.<init>(rktest.java:21)
at mrchen.rktest.main(rktest.java:901)
This happened when I changed my code from using a 2D array of strings
to a 2D array of "Square" objects:
Of course, I made a bunch of other changes to support this as well (method calls to get the String out of the object, for instance), and everything compiled fine, but like I said - when I run it, I get this NullPointerException error.
Any suggestions of common code errors that produce this sort of thing?
Thanks,
Mike
Exception in thread "main" java.lang.NullPointerException
at mrchen.ButtonDrawPanel.<init>(rktest.java:884)
at mrchen.rktest.<init>(rktest.java:21)
at mrchen.rktest.main(rktest.java:901)
This happened when I changed my code from using a 2D array of strings
to a 2D array of "Square" objects:
Of course, I made a bunch of other changes to support this as well (method calls to get the String out of the object, for instance), and everything compiled fine, but like I said - when I run it, I get this NullPointerException error.
Any suggestions of common code errors that produce this sort of thing?
Thanks,
Mike