import java.util.*;
public class StudentMain {
static Student[] data = new Student[3];
static Scanner input = new Scanner(System.in);
public static void InputData() {
System.out.println("학생의 정보를 입력하세요.");
System.out.print("이름: ");
data[0].name = input.nextLine();
}
static public void main(String[] args) {
InputData();
}
}
class Student extends StudentMain {
String name;
public Student() {
this.name = data[0].name;
}
}
이름: 1
Exception in thread "main" java.lang.NullPointerException
at StudentMain.InputData(StudentMain.java:12)
at StudentMain.main(StudentMain.java:17)
위와같이 짯는데 왜 에러가 발생되는지 모르겠어요ㅠ