Search:

Type: Posts; User: helloworld922

Search: Search took 0.07 seconds.

  1. Replies
    5
    Views
    1,185

    Re: Array with null (same for Arraylist)

    That works the first time getStudent() is called, but what happens if someone calls getStudent() again?

    There's really no reason student should be an object field, move it in as a local variable...
  2. Replies
    5
    Views
    1,185

    Re: Array with null (same for Arraylist)

    You never initially initialized the student string so Java by default assigns it the value of null. Before your for loop, try setting student to the empty string.
Results 1 to 2 of 2