我收到Integer.parseInt()方法NumberFormatException。我知道這個異常是在類似「ab」的東西傳遞給方法時產生的,但我很難找到發生這種情況的地方。 我該如何解決這個問題?殺死此NumberFormatException
我正在使用Netbeans並試圖調試在caseStartLineSplitted[0]
變量上放置手錶,然後點擊f7,但代碼像Arrays類一樣,我不在乎。我怎樣才能讓它直接進入caseStartLineSplitted[0]
得到改變?
輸入文件是:
2
3 2 1
ab
1 0
2 0
2 0
2
0 3
abaa
aab
aba
3 3 2
ade
0 1 2
1 2 0
2 1 0
1 2
2 2
a
de
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package afd;
import java.io.*;
import java.util.*;
/**
*
* @author Administrator
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
// TODO code application logic here
FileReader fr = new FileReader("E://Documents and Settings//Administrator//My Documents//NetBeansProjects//AFD//src//afd//dfa.in");
BufferedReader br = new BufferedReader(fr);
String firstLine= br.readLine();
String [] firstLineSplitted = firstLine.split(" ");
/*debug*/
System.out.println(firstLine);
int numberOfTestCases = Integer.parseInt(firstLine);
for (int indexOfTestCases =0; indexOfTestCases < numberOfTestCases; indexOfTestCases++ ){
String caseStartLine = br.readLine();
/*debug*/
System.out.println(caseStartLine);
String [] caseStartLineSplitted = caseStartLine.split("");
int numberOfStates = Integer.parseInt(caseStartLineSplitted[0]);
int numberOfAlphabetSymbols = Integer.parseInt(caseStartLineSplitted[1]);
//int numberOfFinalStates = Integer.parseInt(caseStartLineSplitted[2]);
String alphabetLine = br.readLine();
for (int indexOfStates = 0; indexOfStates < numberOfStates; indexOfStates++){
String ijLine = br.readLine();
String [] ijLineSplitted = ijLine.split(" ");
int i = Integer.parseInt(ijLineSplitted[0]);
int j = Integer.parseInt(ijLineSplitted[1]);
}
String finalStatesLine = br.readLine();
String finalStatesLineSplitted [] = finalStatesLine.split(" ");
ArrayList<Integer> finalStates = new ArrayList<Integer>();
for (int conversionIndex =0; conversionIndex < finalStatesLineSplitted.length;)
}
}
}
是的,謝謝。 – andandandand 2009-12-08 21:39:16