I wanted to get some better understanding by this statement and the code that follows with it.
This will make it so that calling code needs to check for the possibility of that exception being thrown.
int divide(int x, int y) throws Exception {
if (y == 0) {
throw new Exception();
}
return x / y;
}
void doStuff() {
divide(1, 0);
}
Is it my understanding that "checked" just means that depending on the Exception given that if used elsewhere we need to also ensure that the Expection used is also thrown in the supporting methods/functions?
So something like throws Exception needs to also be added to doStuff() in this case but if this was a RuntimeException it would only need to be handled on the method/function that has a chance of causing the RuntimeException?
-- Edit --
As I moved onto Propagating Exceptions I think it makes more sense now what is occuring.