Java throwing exception and exception handling instruction