有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (2) 个答案

  1. # 1 楼答案

    Questions_Driving_license类中的字段创建公共getter,例如:

    public String questions(){
      return this.questions;
    }
    

    然后像这样使用这个getter:

    questions_Driving_license.getQuestions().length
    

    更重要的是,这个类应该被命名为QuestionsDrivingLicence

  2. # 2 楼答案

    不能访问设置为私有的变量。 使用getter获取变量,然后对其执行操作。使用

    public String getQuestions(){ return questions; }

    Questions_Driving_License类中