[Java lista] A continue utasítás átugorja a finally blokkot?
Kristof Jozsa
dyn at ond.vein.hu
2008. Jún. 12., Cs, 15:35:52 CEST
sot, ha a catchben return van a finallyban meg continue akkor nem lesz
return se.
K
Peter Verhas wrote:
> public class CatchTestContinue {
>
> public static void main(String arg[]){
>
> System.out.println("before loop");
>
> for (int i = 1; i < 10; i++) {
> try {
> System.out.println("in loop i=" + i);
> if (i == 5)
> throw new Exception("ho ho ho");
> } catch (Exception e) {
> System.out.println("in exception i=" + i);
> continue;
> } finally {
> System.out.println("in finally i=" + i);
> }
> }
> System.out.println("after loop");
> }
> }
>
>
> before loop
> in loop i=1
> in finally i=1
> in loop i=2
> in finally i=2
> in loop i=3
> in finally i=3
> in loop i=4
> in finally i=4
> in loop i=5
> in exception i=5
> in finally i=5
> in loop i=6
> in finally i=6
> in loop i=7
> in finally i=7
> in loop i=8
> in finally i=8
> in loop i=9
> in finally i=9
> after loop
> _______________________________________________
> Javalist mailing list
> Javalist at javagrund.hu
> http://javagrund.hu/mailman/listinfo/javalist
További információk a(z) Javalist levelezőlistáról