Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-29-2008, 11:34 PM
Member
 
Join Date: Apr 2008
Posts: 4
mensa is an unknown quantity at this point
NullPointerException
i am novice in oop & java, i have a problem with this error :
"Exception in thread "main" java.lang.NullPointerException"
when i want to try create new object, these lines of my code cause it
public void AddManager (Manager m){
managers[managerIndex++] = m;(in my manager class &)

n= new Manager(manName,salary,numberProject);
boss.AddManager(n); (in my main class)

plz help me
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-30-2008, 12:03 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 220
DonCash will become famous soon enoughDonCash will become famous soon enough
Hello mensa,

Welcome to the Java Forums.

Somewhere in your code a null value is being returned. Can you post the code from all your classes here and please put the [code] [/ code] tags around it. (Minus the space after /)

Thank you.
__________________
Did this post help you? Please me! || Don't forget to: Mark your Thread as Solved
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-30-2008, 12:08 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,125
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Provide some code to see pal. As Don says your code return a null value, looking at few code lines you have provide can't say much.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best?Vote Now
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-30-2008, 09:46 PM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 218
Zosden is on a distinguished road
It should tell you where your calling the object that is null. Thankfully your working in Java because in c++ it would just find a spot in ram and call that your data, and whatever arbitrary data was there before your program now thinks that represents your object.
__________________
Definition of Impossible = making a good game in Java.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 05-03-2008, 07:17 PM
Member
 
Join Date: Apr 2008
Posts: 4
mensa is an unknown quantity at this point
hello DonCash,
i wated to attach my code but i could't , then i inserted my code in my message but it failed again and this error occured:
"The site could be temporarily unavailable or too busy. Try again in a few
moments.

If you are unable to load any pages, check your computer's network
connection.

If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web. "

i have no firewall & proxy , is any way to solve it?
THK
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 05-04-2008, 12:19 AM
danielstoner's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Canada
Posts: 117
danielstoner is on a distinguished road
- managers array could be null
- Manager(manName,salary,numberProject) constructor can do something that with the parameters and a parameter could be null
- boss instance could be null
- n could be null and boss.AddManager(n); can try to do something with n

Unless you post your full code we cannot point to the exact error.
__________________
Daniel @ [www.littletutorials.com]
Language is froth on the surface of thought
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
NullPointerException ravian New To Java 2 12-07-2007 05:20 PM
NullPointerException Feng New To Java 5 11-24-2007 08:51 PM
nullPointerException problem conandor Networking 1 08-14-2007 02:22 PM
NullPointerException problem warship AWT / Swing 5 08-10-2007 05:43 PM
ERROR: nullPointerException mathias New To Java 1 08-05-2007 07:54 AM


All times are GMT +3. The time now is 09:28 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org