源代码如下
   class Student
{String name;final int corseNum=6;int score[]=new int[corseNum];
 Student(String x,int m,int y[]){
 name=x; corseNum=m; 
 for(k=0;k<score.length;k++){
         score[k]=y[k];}}
  public void nameShow(){}
  public void nameGet(){}
  void scoreShow(){}
  void scoreGet(){}
  public int avescoreCalculate(){int sum;double ave;
    for(int i=0;i<score.length;i++){
sum+=i;
ave=sum/corseNum;
}
System.out.println("ave score"+ave);
  }
}final class Benke extends Student{
 Benke(String x,int m,int y[]){
super(x,m,y[k]);}
 public void ifDegreeThr1(){
if (ave>80)
  {System.out.println("学位通过");}
else
    {System.out.println("学位不能通过");}  
  }
}final class Yanjiu extends Student{
 Yanjiu(String x,int m,int y[]){
    super(x,m,y[k]);}
  public void ifDegreeThr2(){ 
  if (score[2]>90&&score[4]>80)
  {System.out.println("学位通过");}
else
   {System.out.println("学位不能通过");} 
  }
}public class  Demo
{
public static void main(String[] args) 
{Benke a=new Benke();
a.name="li li";
    a.corseNum=6;
        a.score[0]=90;
a.score[1]=85;
a.score[2]=90;
a.score[3]=90;
        a.score[4]=85;
a.score[5]=90;
a.avescoreCalculate();
a.ifDegreeThr1();
Yanjiu b=new Yanjiu();
    b.name="zhao er";
b.corseNum=6;
b.score[0]=100;
        b.score[1]=90;
        b.score[2]=95;
        b.score[3]=90;
b.score[4]=80;
        b.score[5]=85;
b.avescoreCalculate();
        b.ifDegreeThr2();

解决方案 »

  1.   

    先给大伙道个歉,对不住啊。是我没把问题描述清楚。
    是这样的:编译时,{System.out.println("学位不能通过");} {System.out.println("学位通过");}
        提示存在非法字符,我检查了语法还有大小写,发现并无问题。因此不知道错在哪了?
       
      

  2.   

    System.out.println("学位不能通过");}
    看看前后是否有全角空格
      

  3.   

    代码没贴全Benke类中的ave没有定义吧..你最好还是用个IDE Jcreator或者 Eclipse.. 清楚点
      

  4.   

    但从你 贴上来的代码看  有一大顿问题
    1, for(k=0;k<score.length;k++){  应该是 for( int k=0;k<score.length;k++){
    2,public int avescoreCalculate() 这个方法没有返回值
    3,corseNum=m;    corseNum 都 dinal了 就不要再去赋值了
    等等 类似 if语句缺少 } 去关闭的
     不愿意看了  
      

  5.   

    谢谢9楼的同志,根据您的提示做修改,关于System.out.println("学位不能通过");}的错误提示果然就没有了。只是,又出现了更多其它错误提示,我自己再好好把它研究研究。
      

  6.   

    做项目的时候代码要是写成这样可是会被人BS的,LZ得注意了
      

  7.   

    建议楼主:先使用记事本类开发工具(如notepad++),逐行逐行code,并编辑运行。不要嫌麻烦