java中出现的问题

classStudent{privateStringname;privateintage;privatefloatcomputer;privatefloatmath;pr... class Student{
private String name;
private int age;
private float computer;
private float math;
private float english;
public Student(){}
public Student(String n,int a,float c,float m,float e){
this.setName(n);
this.setAge(a);
this.setComputer(c);
this.setMath(m);
this.setEnglish(e);
}
public float sum()
{
return computer+math+english;
}
public float avg()
{
retrun (computer+math+english)/3 ;
}
public float max()
{
float max=computer>english?computer:english;
return max=max>math?max:math;
}
public float min()
{
float min=computer>english?english:computer;
return min=min>math?math:min;
}
public String getInfo()
{
return "学生信息:\n"+
"\t姓名:"+name+
"\t年龄:"+age+
"\t计算机成绩:"+computer+
"\t英语成绩:"+english+
"\t数学成绩"+math;
}
public void setName(String n)
{
name=n;
}
public void setAge(int a)
{
age=a;
}
public void setComputer(float c)
{
computer=c;
}
public void setMath(float m)
{
math=m;
}
public void setEnglish(float e)
{
english=e;
}
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
public float getComputer()
{
return computer;
}
public float getMath()
{
return math;
}
public float getEnglish()
{
return english;
}

}
public class Test4{
public static void main(String args[])
{
Student stu=new Student("lirong",21,80,90,68);
System.out.println("总分:"+stu.sum());
System.out.println("平均分:"+stu.avg());
System.out.println("最高分:"+stu.max());
System.out.println("最低分"+str.min());
}
}
显示结果是Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>f:
F:\>cd test.java
F:\test.java>javac Test4.java
Test4.java:21: 不是语句
retrun (computer+math+english)/3 ;
^
1 错误
F:\test.java>
展开
 我来答
lkstarsea
2013-07-20 · TA获得超过315个赞
知道小有建树答主
回答量:201
采纳率:100%
帮助的人:189万
展开全部
class Student{
private String name;
private int age;
private float computer;
private float math;
private float english;
public Student(){}
public Student(String n,int a,float c,float m,float e){
this.setName(n);
this.setAge(a);
this.setComputer(c);
this.setMath(m);
this.setEnglish(e);
}
public float sum()
{
return computer+math+english;
}
public float avg()
{
return (computer+math+english)/3 ;
}
public float max()
{
float max=computer>english?computer:english;
return max=max>math?max:math;
}
public float min()
{
float min=computer>english?english:computer;
return min=min>math?math:min;
}
public String getInfo()
{
return "学生信息:\n"+
"\t姓名:"+name+
"\t年龄:"+age+
"\t计算机成绩:"+computer+
"\t英语成绩:"+english+
"\t数学成绩"+math;
}
public void setName(String n)
{
name=n;
}
public void setAge(int a)
{
age=a;
}
public void setComputer(float c)
{
computer=c;
}
public void setMath(float m)
{
math=m;
}
public void setEnglish(float e)
{
english=e;
}
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
public float getComputer()
{
return computer;
}
public float getMath()
{
return math;
}
public float getEnglish()
{
return english;
}

}
public class Test4{
public static void main(String args[])
{
Student stu=new Student("lirong",21,80,90,68);
System.out.println("总分:"+stu.sum());
System.out.println("平均分:"+stu.avg());
System.out.println("最高分:"+stu.max());
System.out.println("最低分"+stu.min());
}
}
你return拼错了,不是retrun
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式