我想创建一个名为 User 的类的数组对象,当我单击复选框时,应该创建该类的新对象。当我运行并单击复选框错误:线程“AWT-EventQueue-0”java.lang 中的异常。空指针异常
public class User
{
public int user_amt;
int user_location;
String user_name;
private boolean user_isSelected()
{
return true;
}
int user_id;
User()
{
user_amt = 0;
user_location = 0;
user_name = "NUL";
user_id = 0;
user_isSelected();
}
}
class main()
{
int users_active;
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {
users_active++;
User[] user = new User();
}
}