javajava-6legacy-codelegacy-app

Unknown structure in java 1.6


i'm working on a legacy project & i found something like that :

test:{
        if(1 == 1) {
            System.out.println("Oups");
            break test;
        }
        System.out.println("Hello World");
    }

I google it, but nothing seems to match with this kind of structure.

Of course, this part of code compile & run ... ????

Do someone know what that do ?


Solution

  • Jump-out label (Tutorial):

    label: for (int i = 0; i < x; i++) {
        for (int j = 0; j < i; j++) {
            if (something(i, j)) break label; // jumps out of the i loop
        }
    } 
    // i.e. jumps to here