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

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

什么是NumberFormatException以及如何解決?

什么是NumberFormatException以及如何解決?

什么是NumberFormatException以及如何解決?Error Message:Exception in thread "main" java.lang.NumberFormatException: For input string: "Ace of Clubs"    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)    at java.lang.Integer.parseInt(Integer.java:580)    at java.lang.Integer.parseInt(Integer.java:615)    at set07102.Cards.main(Cards.java:68)C:\Users\qasim\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1BUILD FAILED (total time: 0 seconds)我的循環(huán):while (response != 'q' && index < 52) {    System.out.println(cards[index]);    int first_value = Integer.parseInt(cards[index]);    int value = 0;    //Add a Scanner    Scanner scanner = new Scanner(System.in);    System.out.println("Will the next card be higher or lower?, press q if you want to quit");    String guess = scanner.nextLine();    if(cards[index].startsWith("Ace")) { value = 1; }    if(cards[index].startsWith("2")) { value = 2; }    if(cards[index].startsWith("3")) { value = 3; }    //checking 4-10    if(cards[index].startsWith("Queen")){ value = 11; }    if(cards[index].startsWith("King")){ value = 12; }    if(guess.startsWith("h")){        if(value > first_value){ System.out.println("You answer was right, weldone!"); }         else { System.out.println("You answer was wrong, try again!"); }    } else if(guess.startsWith("l")){        if(value < first_value) { System.out.println("You answer as right, try again!"); }        else { System.out.println("You answer was wrong, try again!"); }    } else { System.out.println("Your was not valid, try again!"); }    scanner.close();                index++;}//end of while loop
查看完整描述

3 回答

?
楊__羊羊

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

貌似cards[]字符串數(shù)組,你正試圖轉(zhuǎn)換Ace of Clubs整數(shù)。

int first_value = Integer.parseInt(cards[index]);


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

添加回答

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