(十二)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 ...
随机推荐
- 3. Longest Substring Without Repeating Characters(最长子串,双指针+hash)
Given a string, find the length of the longest substring without repeating characters. Examples: Giv ...
- 199. Binary Tree Right Side View -----层序遍历
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nod ...
- Vue-router学习(一)- 路由匹配
一.Vue-router引入使用 Vue-router就是一个vue路由类,通过new一个Vue路由实例,然后Vue.use()嵌入即可. 一般分为以下步骤: 1.引入 (1).方法一:npm包嵌入, ...
- [HEOI2016/TJOI2016]求和(第二类斯特林数)
题目 [HEOI2016/TJOI2016]求和 关于斯特林数与反演的更多姿势\(\Longrightarrow\)点这里 做法 \[\begin{aligned}\\ Ans&=\sum\l ...
- Bean的id、name、ref、refid
Spring中Bean的命名 1.每个Bean可以有一个id属性,并可以根据该id在IoC容器中查找该Bean,该id属性值必须在IoC容器中唯一: 2.可以不指定id属性,只指定全限定类名,如: & ...
- 8月份的To-Do List
1.汲取归纳<Effective Objective-C 2.0 >的知识点 2.回顾网易云课堂翁恺老师的C语言相关课程, 为学习算法做好准备 3.读完Kelly McGonigal的&l ...
- Spring_事务(1)
- Eclipse 启动tomcat 访问主页报错404
问题 tomcat用startup.sh启动,访问localhost:8080能正常访问,用Eclipse service启动tomcat,访问localhost:8080报错404 解决方法 1. ...
- spark学习10(win下利用Intellij IDEA搭建spark开发环境)
第一步:启动IntelliJ IDEA,选择Create New Project,然后选择Scala,点击下一步,输入项目名称wujiadong.spark继续下一步 第二步:导入spark-asse ...
- 第三篇:Spark SQL Catalyst源码分析之Analyzer
/** Spark SQL源码分析系列文章*/ 前面几篇文章讲解了Spark SQL的核心执行流程和Spark SQL的Catalyst框架的Sql Parser是怎样接受用户输入sql,经过解析生成 ...