عبارت در نهایت به شما امکان می دهد کد را اجرا کنید، پس از تلاش... catch< /code>، صرف نظر از نتیجه:
public class MyClass {
public static void main(String[] args) {
try {
int[] myNumbers = {1, 2, 3};
System.out.println(myNumbers[10]);
} catch (Exception e) {
System.out.println("Something went wrong.");
} finally {
System.out.println("The 'try catch' is finished.");
}
}
}
The output will be:
Something went wrong.
The 'try catch' is finished.