Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TryCatchFinally {
- public static void main(String[] args) {
- try {
- System.out.println("Try block before the error");
- System.out.println(1/0);
- System.out.println("Try block after the error");
- }
- catch (ArithmeticException e)
- {
- System.out.println("Catch Block");
- System.out.println("A stack trace of the error");
- e.printStackTrace();
- System.out.println("The operation is not possible");
- }
- finally
- {
- System.out.println("Finally Block");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement