0
나는 내 시간에 프로그래밍을 배우려고 노력하고 있으며, 여전히 그것에 매달려 있습니다. 나는 다음과 같은 오류가 점점 오전 : 여기java.io.IOException : 핸들이 유효하지 않습니다.
java.io.IOException: The handle is invalid
것은 내가 바이트의 수를 표시 할 때 내가, 내가 arrayListWithNumbers()
메소드를 호출 할 때마다 나는 오류를 받고 있어요 생각 내 코드
public class PrimeFinder {
private int[] prime;
FileInputStream input = null;
//default contructor uses the premade file prime.txt that has the first 10000 digits of pi
public PrimeFinder() throws IOException {
try{
input = new FileInputStream ("primes.txt");
}
finally {
if (input != null) {
input.close();
}
}
}
//constructor with a predefined text file to use.
public PrimeFinder(String txtFile) throws IOException {
try{
input = new FileInputStream(txtFile);
}
finally {
if (input != null) {
input.close();
}
}
}
public static void main(String[] args) throws IOException{
PrimeFinder tester = new PrimeFinder();
tester.arrayListWithNumbers();
}
}
입니다 기본 생성자, 그럼 그것은 완벽하게 작동하고 101281 bytes
의 집계를 보여줍니다.
오류가 발생한 위치를 추측 할 필요가 없습니다. 스택 추적은 발생한 지점을 정확하게 추적합니다. 코드에 대한 참조가 나타날 때까지 호출 체인을 추적하십시오. –