Hummmer 2019-01-05 22:51 采纳率: 100%
浏览 4222
已采纳

新手求助 请问Java编译提示错误找不到符号是因为什么呀?

package com.sample;

private String Name;
private String Age;
private String Sex;
private String IsPartyMember;
private String Position;
private String School;
private String Cclass;
private String TeachingWay;



 //设置名字
    public void setName(String newValue){
        this.Name = newValue;   
      }

    //输出名字
    public String getName(){
        return Name;   
      }

    //设置年龄
    public void setAge(String newValue){
        this.Age = newValue;
    }

    //输出年龄
    public String getAge(){
        return Age;
    }

    //设置性别
    public void setSex(String newValue){
        this.Sex = newValue;
    }

    //输出性别
    public String getSex(){
        if(Sex.equals("man")==true) 
            return "男";
        else
            return "女";
    }


    //设置是否是党员
    public void setIsPartyMember(String newValue){
        this.IsPartyMember = newValue;
    }

    //输出是否是党员
    public String getIsPartyMember(){
        if(IsPartyMember.equals("yes")==true)
            return "是";
        else
            return "否";
    }


     //设置职称
     public void setPosition(String newValue){
         this.Position=newValue;
                  }
     //输出职称
       public string getPosition(){
              if(Position.equals("01")==true)
                     return "助教";
              if(Position.equals("02")==true)
                     return "讲师";
              if(Position.equals("03")==true)
                     return "副教授";
              if(Position.equals("04")==true)
                     return "教授";
                     }
                     //设置院系
      public String setSchool(String newValue){
              this.School=newValue;
                    }
                     //输出院系
    public String getSchool(){
        if(School.equals("001")==true)
            return "软件学院";
        if(School.equals("002")==true)
            return "文学与新闻传播学院";
        if(School.equals("003")==true)
            return "外国语学院";
        if(School.equals("004")==true)
            return "建筑与艺术学院";
        if(School.equals("005")==true)
            return "商学院";
        if(School.equals("006")==true)
            return "法学院";
        if(School.equals("007")==true)
            return "数学与统计学院";
        if(School.equals("008")==true)
            return " 机电工程学院";
        if(School.equals("009")==true)
            return "药学院";
        if(School.equals("010")==true)
            return "航空航天学院";
        if(School.equals("011")==true)
            return "交通运输工程学院";
        if(School.equals("012")==true)
            return "土木工程学院";
        if(School.equals("013")==true)
            return "基础医学院";
        if(School.equals("014")==true)
            return "生命科学学院";
        if(School.equals("015")==true)
            return "材料科学与工程学院";
        if(School.equals("016")==true)
            return "中南大学公共管理学院";
        if(School.equals("017")==true)
            return "马克思主义学院 ";
        if(School.equals("018")==true)
            return "粉末冶金研究院";
        if(School.equals("019")==true)
            return "化学化工学院";

        else
            return "地球科学与信息物理学院";
    }



                  //设置班级
    public void setCclass(String newValue){
        this.Cclass = newValue;
    }

    //输出班级
    public String getCclass(){    
         return Cclass;
    }

    //设置上课方法             
               public String setTeachingWay(string newValue){
                          this.TeachingWay=newValue;
               }
               //输出上课方法
               public String getTeachingWay(){
                           return TeachingWay;
                }

};

图片说明


  • 写回答

3条回答 默认 最新

  • 曾经的宇宙89 2019-01-09 11:07
    关注

    1、有两行代码的string写成了小写
    2、return语句不能只写在if下面,需要有一个默认的返回值(getPosition这个方法)
    3、有返回值类型的方法,必须要有return语句(setSchool/setTeachingWay方法返回值类型改为void)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用