Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 NullPointerException
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BladeOfDeath




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Sat Jan 08, 2005 9:58 pm   Post subject: (No subject)

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




PostPosted: Wed Jan 12, 2005 12:44 pm   Post subject: (No subject)

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




PostPosted: Wed Jan 12, 2005 6:23 pm   Post subject: (No 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");
BladeOfDeath




PostPosted: Wed Jan 12, 2005 6:41 pm   Post subject: (No 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).


Leviathan.java
 Description:

Download
 Filename:  Leviathan.java
 Filesize:  1.81 KB
 Downloaded:  198 Time(s)

wtd




PostPosted: Wed Jan 12, 2005 6:48 pm   Post subject: (No subject)

Can I see a full copy of the error?
BladeOfDeath




PostPosted: Thu Jan 13, 2005 12:12 pm   Post subject: (No subject)

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




PostPosted: Thu Jan 13, 2005 6:19 pm   Post subject: (No subject)

Just use some Java source code!

--MrPenisJr.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: