+ 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.
2 Respostas
+ 2
Example:
try {
x++;
} catch(Exception e) {
//print e
}
It executes the statement, then if theres an exception it does something
+ 2
Check out the 2nd page of the link:
https://www.sololearn.com/learn/Java/2175/