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条)

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向