Is this just an alternative to implementing a try/catch block? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is this just an alternative to implementing a try/catch block?

29th Jul 2016, 10:25 AM
Adiv Abramson
Adiv Abramson - avatar
5 Answers
0
Use throw/throws keywords to handle exceptions.
29th Jul 2016, 2:19 PM
Dilip Belgumpi
Dilip Belgumpi - avatar
0
throw keyword is used to throw the exception.
29th Jul 2016, 3:32 PM
Anantha Padmanabhan B
Anantha Padmanabhan B - avatar
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.
31st Jul 2016, 6:33 AM
No One
No One - avatar
0
Why throw
31st Jul 2016, 4:49 PM
Tribhusan kharel
Tribhusan kharel - avatar
0
throw is just used to indicate error at particular statement in class method or group of statements :) ....
6th Aug 2016, 4:06 PM
Syed Abdul Fazeem