谁能将我这段代码改成没错误的啊
class A
{
public String c;
void A(String c){
this.c=c;
}
}
public class B
{
public static void main(String[] args)
{
A[] a=new A[2];
a[0].c="a";
a[1].c="b";
System.out.print(a[0].c);
System.out.print(a[1].c);
}
}
这个代码,编译没问题,运行出来空指针错误nullpointerException,谁能告诉我怎么改?