program in Java to implement exception handling

March 28, 2019 · Team EasyExamNotes · 1 min read (est.) · 0 comments

Share on WhatsApp
PRINCIPLES OF PROGRAMING LANGUAGES

PRACT. Write a program in Java to implement exception handling. 
public class JavaExceptionExample{
  public static void main(String args[])
  {
   int a = 10;
   try
   {
      int z= a/0;
   }

   catch(ArithmeticException e)
   {
       System.out.println(e);}
   }
  }

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion