0
我想將一個字符串轉換爲一個整數,但我接受了一個錯誤。這裏是我的代碼:字符串到int parseInt
int foo = Integer.parseInt(ABoard[first]);
if (computerBoard[foo] != -1) {
second = computerBoard[foo];
} else {
second = board.getRandomPosition();
while (first==second) {
second = board.getRandomPosition();
}
}
我想借此從一個字符串數組一個數字(INT),然後從一個int數組藉此數的值,如果這個數的值不爲-1。
任何編程語言的錯誤都是有意義的信息。所以閱讀它,瞭解它,並在尋求幫助時至少*發佈實際錯誤* – Kon
你得到的錯誤是什麼? –
stacktrace會有幫助。 – Paul