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

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

java編程,出現(xiàn)線程“main”中出現(xiàn)異常的問(wèn)題

java編程,出現(xiàn)線程“main”中出現(xiàn)異常的問(wèn)題

慕蓋茨4494581 2018-07-10 10:18:08
用idea編寫(xiě)java,出現(xiàn)這種情況Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0at yecheng.Search.main(Search.java:18)Process finished with exit code 1源代碼:public class Search {public static void main(String[] arg){MysqlDB db = new MysqlDB();Index index = new Index();ReadFile rf = new ReadFile();File file = new File(arg[0]);try {rf.readFile(file);index.loadDB(db);int id = index.search(rf.fingerprint,15);System.out.println(id);} catch (Exception e) {e.printStackTrace();System.out.println(e.toString());}}}
查看完整描述

1 回答

?
慕絲7291255

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

取值時(shí),先看下String[] arg 這個(gè)數(shù)組里面有沒(méi)有值,就是做一個(gè)判斷,一般情況下可能是File file = new File(arg[0]); 這一步出錯(cuò),就是 arg數(shù)組沒(méi)有值,但是你取了。
加個(gè)if判斷就行

查看完整回答
反對(duì) 回復(fù) 2018-08-04
  • 1 回答
  • 0 關(guān)注
  • 1813 瀏覽
慕課專欄
更多

添加回答

舉報(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)