Hi. I am learning Java and now stuck in the exceptions chapter. I wrote a code to understand exception. But i am not getting why there is an error saying "Unreachable catch block".Please help me out here. Code is as shown.
public class GetException {
static int i;
public static void main(String[] args) {
try{
System.out.println(i);
}catch(RandomExc RE){
System.out.println("oops!! i is equal to zero!!");
}
}
public void SomeExc() throws RandomExc{
if(i==0)
throw new RandomExc();
}
}
public class RandomExc extends Exception {
RandomExc(){
super("not possible");
}
}
Thanks in advance