課程
/后端開(kāi)發(fā)
/Java
/Java入門(mén)第一季(IDEA工具)升級(jí)版
找不到哪錯(cuò)了
2016-05-12
源自:Java入門(mén)第一季(IDEA工具)升級(jí)版 7-1
正在回答
import java.util.Arrays;public class HelloWorld {???? ??????? //完成 main 方法??? public static void main(String[] args) {??????? int[] scores ={89,-23,64,91,119,52,73};??????? System.out.println("考試成績(jī)的前三名為:");??????? HelloWorld hello = new HelloWorld();??????? hello.showTop(scores);??? }?? ???? public void showTop(int[] scores){??????? // 定義方法完成成績(jī)排序并輸出前三名的功能??????? Arrays.sort(scores);??????? int sum = 0 ;??????? for(int i = scores.length - 1 ; i >= 0 ; i --){??????????? if(scores[i] < 0 || scores[i] > 100){????????????? ??????????????? continue;??????????? }?????????? ??????????????? sum ++ ;?????????? ???????????? if( sum > 3 ){?????????????? ???????????????? break;?????????????? ???????????? }?????????? ???????????? System.out.println(scores[i]);?????????? ???????? }??? }}
第10行 Helloworld -->HelloWorld
18 (int scores)-->(int[] scores)
public void top3(int[] scores){
舉報(bào)
0基礎(chǔ)萌新入門(mén)第一課,從Java環(huán)境搭建、工具使用、基礎(chǔ)語(yǔ)法開(kāi)始
2 回答看看哪錯(cuò)了?
1 回答看看錯(cuò)在哪了
2 回答?看看哪里錯(cuò)了
5 回答看看錯(cuò)哪兒了?
2 回答幫我看看哪錯(cuò)了
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢(xún)優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-05-16
import java.util.Arrays;
public class HelloWorld {
???? ?
?????? //完成 main 方法
??? public static void main(String[] args) {
??????? int[] scores ={89,-23,64,91,119,52,73};
??????? System.out.println("考試成績(jī)的前三名為:");
??????? HelloWorld hello = new HelloWorld();
??????? hello.showTop(scores);
??? }
?? ?
??? public void showTop(int[] scores){
??????? // 定義方法完成成績(jī)排序并輸出前三名的功能
??????? Arrays.sort(scores);
??????? int sum = 0 ;
??????? for(int i = scores.length - 1 ; i >= 0 ; i --){
??????????? if(scores[i] < 0 || scores[i] > 100){
????????????? ?
?????????????? continue;
??????????? }
?????????? ?
?????????????? sum ++ ;
?????????? ?
??????????? if( sum > 3 ){
?????????????? ?
??????????????? break;
?????????????? ?
??????????? }
?????????? ?
??????????? System.out.println(scores[i]);
?????????? ?
??????? }
??? }
}
2016-05-12
第10行 Helloworld -->HelloWorld
18 (int scores)-->(int[] scores)
2016-05-12
public void top3(int[] scores){