On the source code below I\'m rethrowing an Exception.
Why is it not necessary to put the throws keyword on the method\'s signature?
throw new
Exception();is something you should never do in a catch block, but you may have to or want to dothrow new SomeException(throwable);(preserving the full stack trace) instead of throwthrowable;in order to conform to the API of your method, e.g. when it declares to throwSomeExceptionbut you're calling code that might throw anIOExceptionthat you don't want to add to you method's throws clause.The probably most common case is new RuntimeException(throwable); to avoid having a throws clause altogether.