Let's take as reference the next code:
try{
/*Code that may throw IndexOutOfBoundsException or ArrayIndexOut......*/
} catch (IndexOutOfBoundsException e){
/*handle*/
} catch (ArrayIndexOutOfBoundsException e){
/*handle*/
}
Why doesn't this compile, but if a switch the sequence of catch clauses it does compile?
Maybe I must first write a specific exception and then a more general?