我在主要方法中有 NullPointerException
array[0].name = "blue";
结构类:
public class Items {
String name = "";
String disc = "";
}
主要课程:
public class ItemsTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
Items[] array = new Items[2];
array[0].name = "blue"; //NullPointerException
array[0].disc = "make";
array[1].name = "blue";
array[1].disc = "blue";
}
}
请帮助我如何解决这个问题。