Discussion Locked

Java problem

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
What is different between throw and throws

1 reply

by tony hopkinson

creates an exception.

Throws is used to tell the caller that these excptions could be thrown and should be handled.

So if Class1 could throw Exception1 and you added throws Exception1 to class1, anything that calls it will get a compiler nudge to handle Exception1s

HtHs

This discussion is closed to new replies.