From 1f223ecc8de11f566e84637dd5b5623345ef8288 Mon Sep 17 00:00:00 2001 From: Dev Kumar <64922424+rDevKumar@users.noreply.github.com> Date: Thu, 8 Oct 2020 09:14:54 +0530 Subject: [PATCH] Exception Handling --- .../PracticeExceptionHandling.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 exceptionsHandling/PracticeExceptionHandling.java diff --git a/exceptionsHandling/PracticeExceptionHandling.java b/exceptionsHandling/PracticeExceptionHandling.java new file mode 100644 index 0000000..2785b52 --- /dev/null +++ b/exceptionsHandling/PracticeExceptionHandling.java @@ -0,0 +1,21 @@ +package exceptionsHandling; + +public class PracticeExceptionHandling { + + public static void main(String[] args) { + + try { + int a = 7; + int b = 0; + int c = a/b; + System.out.println(c); + }catch(ArithmeticException e) { + System.out.println(e.getMessage()+" the value of denomenator can't be 0"); + } + finally { + System.out.println("bye bye"); + } + } + + } +