seems I make progress...need help..make some progress..and need more help....I am getting a nullPointerException for a project I am doing...I want to display all the info in each object that is in each order, so I got it to work if I fill the max number of items out, but if I don't fill the array it throws a nullPointer. I tried using a counter whenever a object was added and then during the display function just looping through with the max being that counter, but that did not seem to work. Any suggestions
posted 6 years ago
If you create an array and don't fill it, that array will be full of null references. If you try to use those null references, you are liable to suffer a NullPointerException. So you want to fill any arrays as soon as possible after creation.