What is exception in Java ? explain try and catch in Java ?
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...
