hi guys,
please take a look at the following code with these 3 situation?
1. if the code is the way it is, it prints 1, 2, 3, oops.
2.If i changed y to b in line 6, it prints 1,2, oops.
3. If i changed y to b in line 5 and take out the return keyword in line 14, it prints 1,2, oops, oops
Can you explain to me how to approach these 3 situations?
thanks in advance, yuki
---------------
public class Ace{
public static void main(String argv[]){
int b =1;
for(int y =0; y<4; y++){<br /> try {<br /> if(y > 2) { // line 6
throw new Exception();
}
System.out.println(b);
b++;
}
catch (Exception c){
System.out.println("oops");
return; //line 14
}
}
}
}