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
No comments:
Post a Comment