I have question on Java throw exception at class method definition:
public void someMethod () throws SomeException {
try{
...
}catch (SomeException e ){
....
}
}
When we declare throw SomeException at the method declaration, do we still have to try/catch in the body or, can we just use throw new SomeException like this:
public void someMethod () throws SomeException {
// do something
throw new SomeException() ;
}
what is the correct way to throw exception when we have throw Exception at the method declaration.