It means that something on the left side of a dot (.) is 'null' -- either a variable is set to null, or a function is returning null. The stack trace (the error message) tells you what line the error happened at: the top line will say something like
at MyClass.main (MyClass.java:21)
that means the error happened on line 21 of MyClass.java . Look at any dots on that line -- that's where the problem is. We'd be happy to look at the code for you, if you want -- paste it into a reply in this thread. Put [ CODE ] [/ CODE ] tags around the code to preserve formatting in your post (take out the spaces in the tags.)
You didn't show the stack trace or tell me what line it says the error is on, so I have to guess!
The method "contains" references a member variable named "list" (different from the local variable in main of the same name). The member variable "list" is an array. My first guess is that either that member variable is "null" (does anything ever assign a value to it?) or one of the elements of that array is "null" (remember that constructing an array makes an array of null references; there are no objects in the array until they are created.
But it looks like "contains" is as method in some kind of a collection class; it's likely that there's a separate variable that tells how many elements are really in the array; this number is smaller than or equal to the size of the array. The member variable that hold this count should be used as the upper limit of the for loop, not the array length.
Do any of these hints help?
Joined: Feb 03, 2006
so instead of .length it needs to be .size
and yes they help bunches thanks
author and iconoclast
Originally posted by Victoria Preston: so instead of .length it needs to be .size
Well, no, not exactly. I'm imagining that EmployeeClass looks like
So I'm talking about using "size" in place of "list.length" -- but this is only if my guess is right that there is a member like "size". Maybe you should show us the whole "EmployeeList" class (unless you figure this out by yourself now.)
Joined: Feb 03, 2006
okay sorry about the hold up had to go to the store. Here is the entire EmployeeList any feedback would help.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com