尝试这样的事情:
public boolean checkNull() throws IllegalAccessException { for (Field f : getClass().getDeclaredFields()) if (f.get(this) != null) return false; return true; }尽管检查每个变量是否可行可能会更好。

尝试这样的事情:
public boolean checkNull() throws IllegalAccessException { for (Field f : getClass().getDeclaredFields()) if (f.get(this) != null) return false; return true; }尽管检查每个变量是否可行可能会更好。