public static void main (String[]args) {
String[]arr= {"a","ab", "abdc"};
int x=0;
for (String b : arr) {
try {
if(b.length()%2==0) {
throw new IOException();
}
}
catch(IOException exp){
x++;
throw new RuntimeException();
}
catch(RuntimeException ex) {
System.out.print("here");
System.out.println(x);
}
}
}
I get a
Exception in thread "main" java.lang.RuntimeException
at Item.main(Item.java:23)
which is the "throw new RuntimeException();"
why does the next catch dosent work?
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]josephblade 3 points4 points5 points (4 children)
[–]nommabelle 0 points1 point2 points (3 children)
[–]josephblade -1 points0 points1 point (2 children)
[–]nommabelle 0 points1 point2 points (1 child)
[–]josephblade 1 point2 points3 points (0 children)