break的一个另类用法

public class Test {
 
    public static void main(String[] args) throws IOException {
 
        saveLabel: {
            boolean isFlag = true;
            if (isFlag) {
                System.out.println("hehehehe");
                break saveLabel;
            }
            System.out.println("www");
        }
    System.out.println("ttt");
    }
}

猜你喜欢

转载自blog.csdn.net/fzy629442466/article/details/85763711