Tutorials Point


  Java Basics Examples
  Java Tutorial
  Java Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Java Examples - Handle Checked Exception


previous next AddThis Social Bookmark Button


Problem Description:

How to handle checked exception?

Solution:

This example shows how to handle checked exception using catch block.

public class Main {
   public static void main (String args[]) {
      try{
         throw new Exception("throwing an exception");
      }
      catch (Exception e) {
         System.out.println(e.getMessage());
      }
   }
}

Result:

The above code sample will produce the following result.

throwing an exception


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names