本文介绍了抽象类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在做一项任务,以下是问题的一部分: 为大学设计一个程序,以确定是否是学生或教授,很出色。教授杰出的标准是有120多种出版物。学生优秀的标准是平均成绩为3.3。对于教授来说,三类数据余烬将是名称,出版物数量和方法是Outstanding()。 我已经完成了以下代码I am doing an assignment and following is part of the question:A program is to be devised for a university to work out whether or not, a student or a professor, is outstanding. The criterion for a professor to be outstanding is to have over 120 publications. The criterion for a student to be outstanding is to have a Grade Point Average of 3.3. For a professor, the three class data embers would be name, number of publications and the method is Outstanding().I have done the following code 我在这行代码中遇到错误 public boolean outstanding() 请问some1帮我解决这个问题? 非常感谢I am being given an error in this line of codepublic boolean outstanding()Can please some1 help me to solve this problem?Thank you very much推荐答案 展开 | 选择 | 换行 | 行号 你的方法指定它返回一个布尔值,但如果你看一下,就会有一个它可能根本不会返回任何内容。 在方法的开头声明一个boolen并初始化它,在if或if else部分中适当地设置它的值并在结尾处返回布尔值方法。Your method specifies that it returns a boolean but if you look at it, there is a possibility that it might not return anything at all.Declare a boolen at the start of your method and initialize it, set its value appropriately in the if or if else part and return the boolean at the end of the method. 展开 | 选择 | Wrap | 行号 这篇关于抽象类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-19 02:23