A try statement executes a block. If a value is thrown and the try statement has one or more catch clauses that can catch it, then control will be transferred to the first such catch clause.
It looks like I may have for instance two catch clauses for the same exception type. But when I try this I'll receive compile-time error.
public static void main (String[] args) throws java.lang.Exception
{
try{
} catch(RuntimeException ioe){
} catch(NumberFormatException e){ //Already caught
}
}
Could you explain it using JLS?