From c53a5a872c01ca56fd1db5d54ff33868c885eb2e Mon Sep 17 00:00:00 2001 From: Kishan Kumar <68832175+Kishankr09@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:04:37 +0530 Subject: [PATCH] Create Exceptionprg.java --- Exceptionprg.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Exceptionprg.java diff --git a/Exceptionprg.java b/Exceptionprg.java new file mode 100644 index 00000000..d4d2d257 --- /dev/null +++ b/Exceptionprg.java @@ -0,0 +1,16 @@ +//program to print the exception information using printStackTrace() method + +import java.io.*; + +class GFG { + public static void main (String[] args) { + int a=5; + int b=0; + try{ + System.out.println(a/b); + } + catch(ArithmeticException e){ + e.printStackTrace(); + } + } +}