Good luck finding the problem. Using the above discussed techniques should help.
Type: Posts; User: Norm
Good luck finding the problem. Using the above discussed techniques should help.
That looks about right. How does the code do now when compiled and executed.
You need to add a new object every time the user requests you to add one when he enters a "1".
That looks about right for the code you posted. The array has 100 slots and the code has added one Employee object to the first slot. The rest of the 99 slots are empty and have null values.
You...
That shows that there is no object in the array at that slot. See my post #2
You can print out the whole contents of an array with:
System.out.println("an ID "+...
Here's a sample call to the println method from your program:
System.out.println("2. Display employee data");
Put what you want to see printed inside of the ()s
To see what is in the array at line 108, add a call to the println method just before line 108 and print out the contents of the element in the array the code is trying to access.
The only place I...
Add a println statement to print out the values of all the variables used on line 108 to see which one is null.
Did you understand my last post about using arrays of objects? Where do you put an...
What variable is null at line 108 where the NPE happens? Why doesn't that variable have a valid non-null value?
There are two steps when using an array of objects:
The first step creates the...