plz help!~
public class Student implements Comparable
{
private long studentId;
private String studentName;
private String surname;
public int compareTo(Object other)
{
int order = 0;
{
if (surname.equals(((Student)other).surname))
order = studentName.compareTo(((Student)other).studentName);
else
order = surname.compareTo(((Student)other).surname);
return order;
}
this is my code, when i run the program, i got a NullPointerException in this line : order = surname.compareTo(((Student)other).surname);
what's wrong?? what is it that is null? The surname? or the student object??
plz help me~~ really frustrated to see my assignment becomes like this...i always start early but still end up in this situation...