Java-Label Break Statement

Label Break Statement

Label break statement is used to transfer control unconditionally from one place to another place in program. Once you labeled a block, you can use this label as the target of break statement. When compiler see break statement with label than compiler transfer execution to at end of labeled block.

Program

Program Source

class Javaapp {

    public static void main(String[] args) {
     
        One : {
            Two : {
                Three : {
                    System.out.println("Three");
                    break Two;
                }
                System.out.println("Two");
            }
            System.out.println("One");
        }
    }
}

Leave a Comment