를 슬로우 선언해야 내 클라이언트 코드 :보고되지 않은 예외 java.io FileNotFoundException; 잡은 또는
public static void inputFiles()
{
File inputFile = new File("colors2.txt");
if (!inputFile.exists()) {
throw new FileNotFoundException(("File not found"));
}
ColorSet colorSetter = new ColorSet(inputFile);
}
내 공급 업체 클래스 생성자 :
내가 FileNotFoundException이 java.io의 "보고되지 않은 예외가 점점 계속public ColorSet(File source) throws FileNotFoundException
{
if (!source.exists()) {
throw new FileNotFoundException(("File not found"));
}
colorInput = source;
}
가, 잡힐해야하며 던져 지겠다고 선언했습니다. "
나는 클라이언트 메소드에서 그것을 잡으려고 시도했지만, body 블록에서 호출 할 수 없다는 것을 말하고있다.
내 클라이언트 메소드의 경우 다음과 같습니다. public static void inputFile() throws FileNotFoundException? – pood
네, 그게해야 할 일입니다 –