I want to set a[1]
name to Gabriel
for example, and it always give me the error:
Exception in thread "main" java.lang.NullPointerException
at Register.main(Register.java:4)
My code is:
public class Register {
public static void main(String[] args) {
Employee a[] = new Employee[2];
a[0].setName("Douglas");
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…