为了账号安全,请及时绑定邮箱和手机立即绑定

尽管我的代码返回String,但该函数仍希望返回字符串

尽管我的代码返回String,但该函数仍希望返回字符串

翻阅古今 2021-05-02 12:13:46
//即使返回成功消息后,我仍然会得到String return期望... //任何帮助将不胜感激public String addStudent(Student student) throws Exception {    try    {        Validator validate = new Validator();        validate.validate(student);        if((student.getMark1()<50 && student.getMark2()<50 && student.getMark3()<50) && student.getResult()=='P')            throw new Exception("Service.INVALID_RESULT_PASS");        if((student.getMark1()>=50 || student.getMark2()>=50 || student.getMark3()>=50) && student.getResult()=='F')            throw new Exception("Service.INVALID_RESULT_FAIL");        return "Success";    }    catch(Exception e)    {        System.out.println(e.getMessage());    }}
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 155 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号