double을 포함하는 파일에서 nextDouble()을 사용할 때 java.util.inputmismatchexception을 얻습니다. 여기에 코드의 관련 섹션 :(Java) 파일을 검색 할 때 입력 오류가 발생했습니다.
public static double[] getGravity() throws IOException
{
Scanner file = new Scanner("SurfaceGravity.txt");
double[] gravity = new double[8];
for(int index = 0; index < gravity.length; index++)
gravity[index] = file.nextDouble(); //Here is where I get the error
file.close();
return gravity;
}
는 그리고 여기에 내가 토큰이 늘어나는만큼 잘못된 유형이지만 때 inputmismatchexception가 발생하는 인상이었다 SurfaceGravity.txt
의 내용3.700465457603474
8.8661999605471
9.8
3.697967684866716
24.776754466506414
10.43814587026926
8.861473215210253
11.131680688084042
0.6128071987535232
입니다 파일의 모든 토큰에 복식이라고 말할 수 있으므로 약간 혼란 스럽습니다.