0
예외를 throw하고 다른 예외를 catch하는 메서드를 작성할 수 있는지 궁금합니다. 예를 들어 예외를 던지고 다른 곳에서 잡는 중
,public static void checkCircle() {
try {
checkPixel(a);
checkPixel(b);
checkPixel(c);
} catch (MyException e) {
System.out.println("not circle");
}
private static void checkPixel(anything) {
if (img.getRGB(xValue, yValue) != pOrigColour) {
throw new MyException();
}
}
class MyException extends Exception {
public MyException() {
}
public MyException(String msg) {
super(msg);
}
}
것은 내가 상관없이 다른 호출의 결과, 더 원이 없음을 나타내는하는 MyException
을 던져 checkPixel
방법으로 할 수 있습니다.
어떤 문제가 있습니까? 어떤 오류가 있었습니까? –