0
Is this just an alternative to implementing a try/catch block?
5 Antworten
0
Use throw/throws keywords to handle exceptions.
0
throw keyword is used to throw the exception.
0
try finally and try (some declaration of something autoclosable like BufferedReader){using the reader} normal catch block.
Alternatively you could use a try catch finally block with a reader . close () in finally.
This is to prevent a lack of resources because of a not closed reader,writer,inputstream..
And as said before:throw and throws
Sorry for my bad English.
0
Why throw
0
throw is just used to indicate error at particular statement in class method or group of statements :) ....