I written my own two customized Exception one is checked and other is unchecked when i'm executing my code is shows only checked Exception Why i'm not able to get unchecked Exception output??
class Test {
public static void main(String args[]) throws CheckedException {
int i=0;
int j=0;
if(i==0){
throw new CheckedException("Got Checked Exception");
}
if(j==0){
throw new UncheckedException("Got Unchecked Exception");
}
}
}
class CheckedException extends Exception{
CheckedException(String s){
super(s);
}
}
class UncheckedException extends RuntimeException{
UncheckedException(String s){
super(s);
}
}
Output of above program is : Got Checked Exception ,But i'm expecting both output Got Checked Exception && Got Unchecked Exception. What mistake i'm doing here? and How can i overcome this?