public void anotherMethod() throws BadObjectException{
try {
doSomething();
--------------->> }catch(BadObjectException be) {
System.out.println("BadObjectException");
}
}
--------------->> The doSomething method does not throw the BadObjectException.
so the catch statement wont be reached.
You can very well do with removing the try catch block.else have the doSomething
method defined with throws clause.
public void doSomething() throws BadObjectException