Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Replies
    18
    Views
    1,613

    Re: Help with error on second run through array

    Good luck finding the problem. Using the above discussed techniques should help.
  2. Replies
    18
    Views
    1,613

    Re: Help with error on second run through array

    That looks about right. How does the code do now when compiled and executed.
  3. Replies
    18
    Views
    1,613

    Re: Help with error on second run through array

    You need to add a new object every time the user requests you to add one when he enters a "1".
  4. Replies
    18
    Views
    1,613

    Re: Help with error on second run through array

    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...
  5. Replies
    18
    Views
    1,613

    Re: Help with error on second run through array

    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 "+...
  6. Replies
    18
    Views
    1,613

    Re: Help with error on second run through array

    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
  7. Replies
    18
    Views
    1,613

    Re: Help with error on second run through array

    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...
  8. Replies
    18
    Views
    1,613

    Re: Help with error on second run through array

    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...
  9. Replies
    18
    Views
    1,613

    Re: Help with error on second run through array

    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...
Results 1 to 9 of 9