What is exception in Java ? explain try and catch in Java ?
October 28, 2007 · Filed Under Java SE Interview questions, Placement Questions
![]() Don't want to miss a single bit? Subscribe By Email for Daily Jobs |
Exception is language feature which allows easy handling of errors.
Try catch is error handling routine using exceptions. Try block indicates that exception may occur in that part of code and catch block provides handling of it.
try {
// Code that might generate exceptions
} catch(Type1 id1) {
// Handle exceptions of Type1
} catch(Type2 id2) {
// Handle exceptions of Type2
} catch(Type3 id3) {
// Handle exceptions of Type3
}
// etc…
Related Articles
- What are the Standard Exceptions in C++ ?
- What is the Exception Handling mechanism in C++ ? What is Try and Catch in C++ ?
- Can You write your own exeptions in Java ?
- Which are the various message map macros ?
- What are the different frameworks available In AJAX?


