Try / Catch trouble | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Try / Catch trouble

Anyone want to explain how to use try and catch in Java? How is it used? how is it superior to if/else?

10th Feb 2017, 11:18 PM
LordHill
LordHill - avatar
1 Answer
+ 1
You have to try/catch if you use an statement that could cause (throw) an exception. Further information: https://docs.oracle.com/javase/tutorial/essential/exceptions/handling.html
10th Feb 2017, 11:23 PM
Tashi N
Tashi N - avatar