COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button
JAVA EXAMPLES RUNTIME EXCEPTIONS
Java Examples - Runtime Exceptions
Problem Description:
How to handle 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()
No comments:
Post a Comment