I have this snippet.
public final class StackOverflow{
class MyException extends Throwable{
}
private void a(){
try{
}catch(MyException | Exception e){
}
}
}
exception StackOverflow.MyException is never thrown in body of corresponding try statement
I know that Exception is extending Throwable as well and also is a checked exception also MyException is extending Throwable which mades also a checked exception!
My question is why Exception is not required to be thrown in the try catch but MyException is? I think that both are checked exception so which is the difference??
Sorry if the question is simple.