Results 1 to 6 of 6
Thread: NullPointerException
- 04-29-2008, 10:34 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 4
- Rep Power
- 0
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:)
- 04-30-2008, 11:03 AM #2
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? Pleaseme! :cool:
- 04-30-2008, 11:08 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 23
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.
- 04-30-2008, 08:46 PM #4
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.
My IP address is 127.0.0.1
- 05-03-2008, 06:17 PM #5
Member
- Join Date
- Apr 2008
- Posts
- 4
- Rep Power
- 0
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
- 05-03-2008, 11:19 PM #6
- 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
Similar Threads
-
NullPointerException
By ravian in forum New To JavaReplies: 2Last Post: 12-07-2007, 04:20 PM -
NullPointerException
By Feng in forum New To JavaReplies: 5Last Post: 11-24-2007, 07:51 PM -
nullPointerException problem
By conandor in forum NetworkingReplies: 1Last Post: 08-14-2007, 01:22 PM -
NullPointerException problem
By warship in forum AWT / SwingReplies: 5Last Post: 08-10-2007, 04:43 PM -
ERROR: nullPointerException
By mathias in forum New To JavaReplies: 1Last Post: 08-05-2007, 06:54 AM
Bookmarks