I understand the idea of this error. But I think I don’t understand how this works in the call stack.
Main.java file:
public static void main(String[] args) { try { Function1(); } catch (myException e) { System.out.println(e.getMessage()); } } public static void Function1() { Function2(); }
Function2 exists in another file:
File2.java
public void Function2() throws myException { .... }
So, after a few calls (down the call stack), I have Function2, which indicates the requirement "throws myException". Why doesn't the main function (where the error is sent) recognize that I am throwing myException on a line?
Any guidance in which the “hole” in my “exception” is at the core is appreciated.
aitee
aitee source share