第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

大佬幫我找找哪兒有問(wèn)題?

import java.util.Arrays;//導(dǎo)入類

public class HelloWorld {

? ??

? ? //完成 main 方法

? ? public static void main(String[] args) {

? ? ? ? //定義一個(gè)對(duì)象

? ? ?HelloWorld hello=new HelloWorld();? ? ? ? ? ? ? ??

? ? ?//創(chuàng)建一個(gè)整型數(shù)組保存成績(jī)

? ? int scores[]={89 , -23 , 64 , 91 , 119 , 52 , 73}

? ? ?System.out.println(" 本次考試前三名是:");

? ? ?/*調(diào)用并接收方法的返回值

? ? ? 將cjFf方法的返回值保存到scor數(shù)組

? ? ?*/

? ? ? ? int scor[]=hello.cjFf(scores);?

? ? ? ??

? ? ?for(int y=0;y>2;y++){ //遍歷接收返回值的數(shù)組

? ? ?

? ? ? ? System.out.println(scor[y]) //分別輸出返回?cái)?shù)組的每個(gè)值

? ? ?}

? ? ? ??

? ? }

? ??

? ? //定義方法完成成績(jī)排序并輸出前三名的功能

? ? public static int[] cjFf(int[] scores){? ? //創(chuàng)建一個(gè)cjFf方法參數(shù)為scores數(shù)組

? ??

? ? ? ? int a=0;? ? //用于記錄有效成績(jī)數(shù)量

? ? ? ??

? ? ? ? ?Arrays.sort(scores);? ?//將數(shù)組scores排序

? ? ? ? ?

? ? ? ? ?int score=new int[2];? ?//新建一個(gè)int型數(shù)組用于返回值

? ? ? ? ?

? ? ? ? ?for(int i=scores.length-1;i>=0;i--){? ?//從大到小的順序遍歷scores數(shù)組

? ? ? ? ?

? ? ? ? ? ? ?if(a=3){? ? ?//判斷有效成績(jī)是否已經(jīng)滿足3個(gè)

? ? ? ? ? ? ?

? ? ? ? ? ? ? continue;? ? ?//滿足直接跳出for循環(huán)

? ? ? ? ? ? ??

? ? ? ? ? ? ?}

? ? ? ? ? ? ?else? ?//不滿足繼續(xù)賦值

? ? ? ? ? ? ?

? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ?if(scores[i]<0||scores[i]>100)? //判斷數(shù)組的成績(jī)滿足要求不

? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ?score[a]=scores[i];? ?//滿足要求將數(shù)組的值賦予將返回的數(shù)組

? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ?a=a+1;? ?//有效成績(jī)加一

? ? ? ? ? ? ? ??

? ? ? ? ? ? ?}

? ? ? ? ? ? ?

? ? ? ? ?}

? ? ? ? return score;//將數(shù)組返回

? ? ? ??

? ? }

? ??

}


正在回答

2 回答

新建一個(gè)int型數(shù)組用于返回值

int score=new int[3]; ??


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_心態(tài)_3 提問(wèn)者

非常感謝!
2018-06-06 回復(fù) 有任何疑惑可以回復(fù)我~

https://img1.sycdn.imooc.com//5b1a4211000159ef14810836.jpg

看圖片。

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

大佬幫我找找哪兒有問(wèn)題?

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)