What happens if a method throws an exception that was not specified in the method declaration with “throws”
问题 I've never used the "throws" clause, and today a mate told me that I had to specify in the method declaration which exceptions the method may throw. However, I've been using exceptions without problems without doing it, so, why is it needed if, in fact, it's needed? 回答1: Java has two different types of exceptions: checked Exceptions and unchecked Exceptions. Unchecked exceptions are subclasses of RuntimeException and you don't have to add a throws declaration. All other exceptions have to be