adsense


Showing posts with label JAVA EXAMPLES HANDLE CHECKED EXCEPTION. Show all posts
Showing posts with label JAVA EXAMPLES HANDLE CHECKED EXCEPTION. Show all posts

Thursday, 29 October 2015

JAVA EXAMPLES HANDLE CHECKED EXCEPTION PAGE 131

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



JAVA EXAMPLES HANDLE CHECKED EXCEPTION





Java Examples - Handle Checked Exception


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