Computer Science Canada

NullPointerException

Author:  BladeOfDeath [ Sat Jan 08, 2005 9:51 pm ]
Post subject:  NullPointerException

I get this error every time I something with the paint command in "Ready To Program" which is the program I must use for my computer science course. A little help would be appreciated, if I could fix this problem I could get extra marks on my ISU.

Author:  wtd [ Sat Jan 08, 2005 9:58 pm ]
Post subject: 

Use the API reference: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/NullPointerException.html

Author:  BladeOfDeath [ Wed Jan 12, 2005 12:44 pm ]
Post subject: 

okay I looked at the site but I don't know how to fix it, mind telling me how?

Author:  wtd [ Wed Jan 12, 2005 6:23 pm ]
Post subject: 

My guess is that somewhere you've declared an object-type variable, but haven't used "new" to create it. Like:

code:
StringBuffer sb;

sb.append("Hello");


instead of:

code:
StringBuffer sb = new StringBuffer();

sb.append("Hello");

Author:  BladeOfDeath [ Wed Jan 12, 2005 6:41 pm ]
Post subject: 

Well... I think it has something to do with the Image variables or something, because I've never had this error unless using graphics. I'll attach a copy of the code if you wanna check it out for yourself (the images are not enclosed).

Author:  wtd [ Wed Jan 12, 2005 6:48 pm ]
Post subject: 

Can I see a full copy of the error?

Author:  BladeOfDeath [ Thu Jan 13, 2005 12:12 pm ]
Post subject: 

it only shows at home, but when i get home ill send it. Thanks for the help though

Author:  MrPenisJr. [ Thu Jan 13, 2005 6:19 pm ]
Post subject: 

Just use some Java source code!

--MrPenisJr.


: