# 1 楼答案 为Questions_Driving_license类中的字段创建公共getter,例如: public String questions(){ return this.questions; } 然后像这样使用这个getter: questions_Driving_license.getQuestions().length 更重要的是,这个类应该被命名为QuestionsDrivingLicence
# 2 楼答案 不能访问设置为私有的变量。 使用getter获取变量,然后对其执行操作。使用 public String getQuestions(){ return questions; } 在Questions_Driving_License类中
# 1 楼答案
为
Questions_Driving_license
类中的字段创建公共getter,例如:然后像这样使用这个getter:
更重要的是,这个类应该被命名为
QuestionsDrivingLicence
# 2 楼答案
不能访问设置为私有的变量。 使用getter获取变量,然后对其执行操作。使用
public String getQuestions(){ return questions; }
在
Questions_Driving_License
类中