java for

作者在 2016-12-01 20:49:20 发布以下内容
package fuck;

public class Out 
{
	public static void main(String[] args)
	{
		outer:
		for (int i =0 ;i <5; i++)
			{
				for (int k = 0 ;k <3 ;k++)
					{
						System.out.println("i value" + k);
						if (k == 1)
							{
								break outer;//	i value0
											//  i value1
							}
					}
			
			
			}
		for (int i = 0 ;i < 3 ; i++)
			{
				System.out.println("i values" + i);
				if (i == 1)
					{
						continue;
					}
					System.out.println("continue behind");
			}
		outer:
		for (int i = 0 ; i < 5; i++)
			{
				for (int s  = 0; s <3;s++)
					{
						System.out.println("i values" + i + ",s value" + s);
						if (s ==1)
							{
								continue outer;
							}
					}
			}
		for (int i = 0 ; i < 3;i++)
			{
				System.out.println("i values" + i);
				if (i == 1)
					{
						return;//return 结束整个方法,不管这个return处于多少层循环中
					}
			}System.out.println("continue behinds");	
	}
}
JAVA | 阅读 1141 次
文章评论,共0条
游客请输入验证码
浏览2354343次