慕粉1044461252
2016-12-31 00:50
public class HelloWorld {
//完成 main 方法
public static void main(String[] args) {
int [] scroes ={89,-23,6,91,119,52,73};
HelloWorld hello=new HelloWorld();
int nums []=hello.garde(scroes);
for(int i=0;i<3;i++)
System.out.println(nums[i]);
}
//定义方法完成成绩排序并输出前三名的功能
public int [] garde (int scroes [])
{
for(int i=0;i<scroes.length-1;i++){
for(int j=i+1;j<scroes.length;j++){
if(scroes[i]<scores[j])
{
int temp=scroes[j];
scroes[j]=scroes[i];
scroes[i]=temp;
}
}
}
return scroes ;
}说我第23行定义报错,看了半天没看懂这是为什么
/85/1598/Jcdd/HelloWorld.java:23: error: cannot find symbol
if(scroes[i]
第22行,后面的scores应该改成scroes,你前面都是定义的scroes的,改过来试试
因为你22行 if判断里面 score写错了
Java入门第一季(IDEA工具)
1168373 学习 · 18754 问题
相似问题
回答 1