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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

使用.split()報(bào)錯(cuò)數(shù)組越界怎么處理?

使用.split()報(bào)錯(cuò)數(shù)組越界怎么處理?

public?static?void?showTotalScoreAvg()?throws?IOException{ ????????????double?sum?=?0; ????????????BufferedReader?in?=?new?BufferedReader(new?FileReader(path)); ????????????String?studentScore; ????????????while((studentScore?=?in.readLine())?!=?null) ????????????{ ????????????????double?mathScore?=?Double.parseDouble(studentScore.split("\t")[2]); ????????????????double?englishScore?=?Double.parseDouble(studentScore.split("\t")[3]); ????????????????double?computerScore?=?Double.parseDouble(studentScore.split("\t")[4]); ????????????????double?totalScore?=?mathScore?+?englishScore?+computerScore; ????????????????sum?=?sum?+?totalScore; ????????????????count++; ????????????????if(MinTotalScore?>?totalScore) ????????????????{ ????????????????????MinTotalScore?=?totalScore; ????????????????} ????????????????if(MaxTotalScore?<?totalScore) ????????????????{ ????????????????????MaxTotalScore?=?totalScore; ????????????????} ????????????????studentScore?=?in.readLine(); ????????????} ????????????double?totalScoreAvg?=?sum/(double)count; ????????????System.out.println("總成績(jī)平均分為:"+?totalScoreAvg);in.close(); ??????}
查看完整描述

3 回答

?
小草1434

TA貢獻(xiàn)106條經(jīng)驗(yàn) 獲得超23個(gè)贊

在寫(xiě)出這種取具體數(shù)組下標(biāo)語(yǔ)句前,我有個(gè)建議,先判斷下數(shù)組長(zhǎng)度。

目前該問(wèn)題描述的代碼是因?yàn)樵撟址环铣绦蝾A(yù)期的長(zhǎng)度[文件中體現(xiàn)的分?jǐn)?shù)沒(méi)有超過(guò)2個(gè)? /t]

查看完整回答
1 反對(duì) 回復(fù) 2018-05-27
?
動(dòng)感光波biubiubiubiu

TA貢獻(xiàn)2條經(jīng)驗(yàn) 獲得超0個(gè)贊

已解決

查看完整回答
反對(duì) 回復(fù) 2018-05-27
  • 3 回答
  • 0 關(guān)注
  • 1835 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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