Tutorials Point


  Java Basics Examples
  Java Tutorial
  Java Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Java Examples - Runtime Exception


previous next AddThis Social Bookmark Button


Problem Description:

How to handle the runtime exceptions ?

Solution:

This example shows how to handle the runtime exception in a java programs.

public class NeverCaught {
   static void f() {
      throw new RuntimeException("From f()");
   }
   static void g() {
      f();
   }
   public static void main(String[] args) {
      g();
   }
}

Result:

The above code sample will produce the following result.

From f()


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names