class Data {
private String Name;
private String Family;
private int StCode;
private int Average;
private int Link;
//insert start
public void Insert(String name, String family, int stcode, int average) {
if (flag = false) {
Startdata = newadd;
flag = true;
}
if (PointerCount == 0) {
data[newadd].Name = name;
data[newadd].Family = family;
data[newadd].StCode = stcode;
data[newadd].Average = average;
data[newadd].Link = -1;
if (head != -1) {
data[head].Link = newadd;
}
head = newadd;
newadd++;
}
}
错误
Exception in thread "AWT-EventQueue-0" java. lang. NullPointerException
当我想像data[0].Name=" ";
一样插入时,出现此错误。