(十二)break,continue
class Break
{
//break,continue
public static void main(String[] args)
{
//break
for(int i =0;i<=5;i++) {
if(i==3) {
break;
//System.out.println("Hello World");//无法访问的语句
}
System.out.println(i);//0, 1 , 2
}
System.out.println("How are you?"); m:for(int i = 0;i<=5;i++){
n:for(int j = 0;j<=3;j++){
if(j==2) {
break m;
}
}
System.out.println(i);//循环终止,不会有任何结果
} //continue
for(int i = 0;i <=5;i++){
if(i%2==0) {
continue;//当条件符合时,跳过当前循环直接进行i++;
//System.out.println("Hello World!!");//无法访问
}
System.out.println(i);//1,3,5
} x:for(int i = 0;i<=5;i++){
z:for(int j = 0;j<=3;j++){
if(j==2) {
continue x;
}
}
System.out.println(i);//不会有任何结果,每次j==2的时候都会把外层循环终止调。
}
}
}
(十二)break,continue的更多相关文章
- shell编程学习笔记(十二):Shell中的break/continue跳出循环
在循环遍历中,可以添加对应判断条件跳出循环,跳出循环可以使用break/continue,这个跟java语言是一样的,break是指跳出整个循环,continue是指跳出当前循环体,继续下一项循环. ...
- JAVA之旅(二)——if,switch,for,while,do while,语句嵌套,流程控制break , continue ,函数,重载的示例总结
JAVA之旅(二)--if,switch,for,while,do while,语句嵌套,流程控制break , continue ,函数,重载的示例总结 JAVA的思想真的很重要,所以要专心的学-- ...
- centos shell脚本编程2 if 判断 case判断 shell脚本中的循环 for while shell中的函数 break continue test 命令 第三十六节课
centos shell脚本编程2 if 判断 case判断 shell脚本中的循环 for while shell中的函数 break continue test 命令 ...
- 设计模式(十二)职责链模式(Chain of Responsibility)(对象行为型)
设计模式(十二)职责链模式(Chain of Responsibility)(对象行为型) 1.概述 你去政府部门求人办事过吗?有时候你会遇到过官员踢球推责,你的问题在我这里能解决就解决,不能解决就 ...
- MongoDB十二种最有效的模式设计【转】
持续关注MongoDB博客(https://www.mongodb.com/blog)的同学一定会留意到,技术大牛Daniel Coupal 和 Ken W. Alger ,从 今年 2月17 号开始 ...
- JAVA基础知识总结:一到二十二全部总结
>一: 一.软件开发的常识 1.什么是软件? 一系列按照特定顺序组织起来的计算机数据或者指令 常见的软件: 系统软件:Windows\Mac OS \Linux 应用软件:QQ,一系列的播放器( ...
- 十二. Python基础(12)--生成器
十二. Python基础(12)--生成器 1 ● 可迭代对象(iterable) An object capable of returning its members one at a time. ...
- 设计模式 ( 十二 ) 职责链模式(Chain of Responsibility)(对象行为)
设计模式(十二)职责链模式(Chain of Responsibility)(对象行为型) 1.概述 你去政府部门求人办事过吗?有时候你会遇到过官员踢球推责,你的问题在我这里能解决就解决.不能解决就 ...
- 「kuangbin带你飞」专题二十二 区间DP
layout: post title: 「kuangbin带你飞」专题二十二 区间DP author: "luowentaoaa" catalog: true tags: - ku ...
随机推荐
- 牛客网暑期ACM多校训练营(第一场)- J Different Integers (莫队)
题意:裸的莫队题,每个查询Li,Ri,返回区间[1,Li]和[Ri,N]区间中不同的数的个数. 分析:正常的离线查询,是求区间[Li,Ri]中要求的答案,而该题所求答案为外侧两个区间中的答案,那么cn ...
- Loadrunder场景设计篇——定时器(schedule)
A. 定义方案schedule 在 Scenario Schedule面板中,选择一个方案schedule,或通过点击New Schedule定义一个新的方案 定义schedule: a.新建sc ...
- SQL中的几个判断是否存在
库是否存在if exists(select * from master..sysdatabases wherename=N'库名')print 'exists'elseprint 'not exist ...
- 20162326 齐力锋 2017-2018学期 Bag类的补写博客
要求: 代码运行在命令行中,路径要体现学号信息,IDEA中,伪代码要体现个人学号信息 参见Bag的UML图,用Java继承BagInterface实现泛型类Bag,并对方法进行单元测试(JUnit), ...
- nginx反向代理服务器端口问题
nginx可以很方便的配置成反向代理服务器 server { listen 80; server_name bothlog.com; location / { proxy_set_header H ...
- Spring注解(事务)
spring操作数据库 jdbc <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc --> & ...
- mysql分库分表(一)
mysql分库分表 参考: https://blog.csdn.net/xlgen157387/article/details/53976153 https://blog.csdn.net/cleve ...
- IIS Manager could not load type for module provider 'SharedConfig' that is declared in administration.config
https://support.microsoft.com/en-ie/help/3151973/iis-shared-configuration-feature-requires-all-serve ...
- hadoop 2.7.3 源码编译教程
1.工具准备,最靠谱的是hadoop说明文档里要求具备的那些工具. 到hadoop官网,点击source下载hadoop-2.7.3-src.tar.gz. 解压之 tar -zxvf hadoop- ...
- JavaScript常用知识点整理——思维导图
如图 思维导图图片链接 http://www.edrawsoft.cn/viewer/public/s/b8327462051289 有道云笔记图片链接 http://note.youdao.com/ ...