结束多层循环

没有啥意义的东西
public static void main(String[] args) {
        boolean end = false;//结束标志
    	for(int xue = 0;xue <= 9;xue ++){
    		System.out.println("xue=" + xue);
    		if(end) break;
    		for(int xi = 0;xi <= 9;xi ++){
        		System.out.println("    xi=" + xi);
        		if(end) break;
        		for(int hao = 0;hao <= 9;hao ++){
            		System.out.println("        hao=" + hao);
            		if((xue * 10 + xi) * xue == (hao * 100 + hao * 10 + hao) && xue != 0 && hao != 0 ){
            			System.out.println("  学习");
            			System.out.println("X   学");
            			System.out.println("——————");
            			System.out.println("好好好");
            			System.out.println("" + (xue * 10 + xi) + " * " + xue + " = " + (hao * 100 + hao * 10 + hao));
            			end = true;
            			break;
            		}
            	}
        	}
    	}
}



public static void main(String[] args) {
                end: //运算结束
        	for(int xue = 0;xue <= 9;xue ++){
        		System.out.println("xue=" + xue);
        		for(int xi = 0;xi <= 9;xi ++){
            		System.out.println("    xi=" + xi);
            		for(int hao = 0;hao <= 9;hao ++){
                		System.out.println("        hao=" + hao);
                		if((xue * 10 + xi) * xue == (hao * 100 + hao * 10 + hao) && xue != 0 && hao != 0 ){
                			System.out.println("  学习");
                			System.out.println("X   学");
                			System.out.println("——————");
                			System.out.println("好好好");
                			System.out.println("" + (xue * 10 + xi) + " * " + xue + " = " + (hao * 100 + hao * 10 + hao));
                			break end;
                		}
                	}
            	}
        	}
}

你可能感兴趣的:(java,循环)