Quick revision
The short answer
throw is a statement that actually throws one exception object at that point in the code; throws is part of a method or constructor declaration that lists the checked exceptions it may pass on to its caller. An overriding method may declare the same checked exceptions, narrower ones or none at all, but never broader or additional checked ones. For example, if Parent.read() throws IOException, Child.read() may throw FileNotFoundException or nothing, but not Exception.
What to remember
In this answer, we saw that throw is a statement that throws one exception object right away, while throws is a declaration that lists the checked exceptions a method or constructor may pass to its callers. Unchecked exceptions need no declaration. An overriding method may declare the same, narrower or no checked exceptions, but never broader ones, because callers using the parent type only prepared for what the parent declared. Constructors can declare throws as well, and a subclass constructor must carry forward what its super constructor declares.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
throw is a statement that actually throws one exception object at that point in the code; throws is part of a method or constructor declaration that lists the checked exceptions it may pass on to its caller. An overriding method may declare the same checked exceptions, narrower ones or none at all, but never broader or additional checked ones. For example, if Parent.read() throws IOException, Child.read() may throw FileNotFoundException or nothing, but not Exception.
Background to this question
These two keywords differ by one letter, so they are easy to mix up in a hurry, and the overriding rule behind them is a favourite follow-up because it tests whether we understand why Java has checked exceptions at all. The rule is not arbitrary: it protects every caller who uses a subclass through a parent type. In this answer, we will recap checked and unchecked exceptions, look at throw and throws side by side, see why an override cannot widen its throws clause, and finish with constructors and a few edge cases.
1A Quick Recap of Checked and Unchecked Exceptions
Java has two kinds of exceptions. Checked exceptions are subclasses of Exception that are not subclasses of RuntimeException, such as IOException or SQLException. The compiler checks them: a method that may throw one must either catch it or declare it, so callers cannot forget it.
Unchecked exceptions are RuntimeException and its subclasses, such as IllegalArgumentException or NullPointerException, plus Error and its subclasses. The compiler does not track these. We can throw them anywhere without declaring anything, although documenting them in Javadoc is still good practice.
2Throw: Throwing One Exception Now
throw is a statement, like return. It takes one object of a Throwable type and throws it immediately. The rest of the method does not run; Java looks for a matching catch block up the call stack.
Notice that withdraw() has no throws clause. IllegalArgumentException is unchecked, so the compiler is satisfied without one.
3Throws: Declaring What a Method May Pass On
throws belongs to the declaration, after the parameter list. It does not throw anything by itself. It is a promise to callers: this method might end with one of these checked exceptions, so be ready for it.
| throw | throws | |
|---|---|---|
| What it is | A statement inside a method body | A clause in a method or constructor declaration |
| What follows it | One exception object: throw new X(...) | One or more exception types: throws A, B |
| What it does | Throws the exception right now | Declares exceptions that may pass to the caller |
| Needed for checked exceptions? | Creates them | Yes, unless the method catches them |
| Needed for unchecked exceptions? | Creates them | No, optional and rarely used |
So the two work together. Somewhere deep inside Files.newBufferedReader, a throw statement creates the IOException; our throws clause tells the compiler and our callers that it may come out of firstLine(), and the compiler then makes each caller deal with it.
4Can an Overriding Method Declare More Checked Exceptions?
No. An overriding method may declare the same checked exceptions as the method it overrides, subclasses of them, fewer of them, or none. It may not add a new checked exception or replace one with a broader type such as Exception.
4 messages in order. Play them, or step through them one at a time.
The reason is substitution. Code written against Parent only prepares for IOException. When that code receives a BadChild at run time, it still calls read() through the Parent type, and the compiler accepted it because it catches IOException. If BadChild could throw a plain Exception, that checked exception would escape a caller who was promised it never would. Narrowing is safe because a FileNotFoundException is still an IOException, so the caller's catch block still matches.
5Unchecked Exceptions and Constructors
The overriding rule applies only to checked exceptions. An override may throw any unchecked exception, declared or not, because the compiler never promised callers anything about them. That is also why an override that cannot fulfil the parent's contract sometimes throws UnsupportedOperationException.
Constructors can have a throws clause too. A constructor that opens a file or a socket can declare IOException, and then every new expression must handle it. Constructors are not inherited or overridden, so the narrowing rule does not apply, but a subclass constructor that calls super(...) must itself declare or handle whatever the parent constructor declares, because the call to super cannot be wrapped in a try block.
6Follow-up questions
Can an interface method's implementation throw a checked exception the interface does not declare?
No, the same rule applies. If Runnable.run() declares nothing, an implementation cannot declare IOException, which is why code inside a Runnable or a lambda passed to a stream must catch checked exceptions or wrap them in an unchecked type such as UncheckedIOException.
Can we use throw with something that is not an exception?
Only Throwable and its subclasses can be thrown. throw null compiles, because null is assignable to any reference type, but at run time it throws a NullPointerException instead. That is a curiosity rather than something to use.
If two parents declare different exceptions for the same method, what may the child declare?
When a class implements two interfaces that both declare the same method, its implementation may only declare exceptions allowed by both, in practice the common subset. If one interface declares IOException and the other declares nothing, the implementation must declare nothing checked.
7Conclusion
In this answer, we saw that throw is a statement that throws one exception object right away, while throws is a declaration that lists the checked exceptions a method or constructor may pass to its callers. Unchecked exceptions need no declaration. An overriding method may declare the same, narrower or no checked exceptions, but never broader ones, because callers using the parent type only prepared for what the parent declared. Constructors can declare throws as well, and a subclass constructor must carry forward what its super constructor declares.
Open with
throw and throws do different jobs. throw is a statement inside a method body: throw new IllegalArgumentException("...") creates one exception object and throws it right there, so the rest of the method does not run. throws is part of a method or constructor declaration.
Then, if they want more
It lists the checked exceptions the method may pass on, like String read() throws IOException, and the compiler then makes every caller either catch it or declare it too. Unchecked exceptions, meaning RuntimeException and Error subclasses, can be thrown without being declared.
On overriding: an overriding method may declare the same checked exceptions, narrower ones, or none, but never broader or new ones. If Parent.read() throws IOException, Child.read() can throw FileNotFoundException or nothing, but declaring Exception is a compile error.
The reason is substitution: code that holds a Parent reference only catches IOException, so if the child could throw a wider checked exception, it would escape a caller that the compiler promised was safe.
Constructors can declare throws as well, and a subclass constructor has to declare whatever its super constructor declares, because the super call cannot be wrapped in a try block.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- The Java Language Specification, Java SE 21, Java SE 21 API documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What is the difference between throw and throws? Can an overriding method declare more...": https://scrivio-interview-library.netlify.app/java/exceptions/138588bf8b/