What is Try and Catch statement in Java? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

What is Try and Catch statement in Java?

Provide a description of the try-catch statement. Describe how this statement can be used to handle errors and exceptions and include an example of try-catch implemented to handle an error or exception within a Java program.

18th Feb 2019, 10:02 PM
Mohammed Amir Khan
Mohammed Amir Khan - avatar
2 Réponses
+ 2
Example: try { x++; } catch(Exception e) { //print e } It executes the statement, then if theres an exception it does something
18th Feb 2019, 10:48 PM
Ole113
Ole113 - avatar
+ 2
Check out the 2nd page of the link: https://www.sololearn.com/learn/Java/2175/
18th Feb 2019, 11:46 PM
Lambda_Driver
Lambda_Driver - avatar