hey everyone, i was wondering if someone could help me out with my code... i know some of it may be confusing and could probably be cut down a little bit but im ok with that.... my problem is that i need to sort my names array and as you can see i already have that coded and it compiles fine, but when i run the code i get the following errors:
Exception in thread "main" java.lang.NullPointerException
if anyone could help me out with this and help explain what i can do to fix this, my computer science teacher was completley stumped when i showed him this, because it works completely fine when the sorting code is taken out, so again any and all help would be appreciated and thank you in advanced
Once I found out where the Exception occurred, it became obvious why. Insert the following just before line 95, which appears to be where the Exception occurs:Then go back to where those objects are initialised and see if you can work out why it went wrong.
posted 10 years ago
I see Steve has beaten me to it.
It is not good design to have several parallel arrays; you ought to have a Student class incorporating the name and marks, and use a Student array.