当前位置: 首页 > news >正文

网站 建设 后台管理程序拼多多关键词优化是怎么弄的

网站 建设 后台管理程序,拼多多关键词优化是怎么弄的,怎么推广公司的网站,肇庆市网站建设1.概述 不知道大家有没有这样一种感受哈,有的时候容易混淆break语句和continue语句的用法,总是模棱两可,不敢确定自己是否使用正确了。正好,我们本篇的重点就是break和continue关键字的用法。 2.使用场景 Java中为啥会诞生break…

1.概述

不知道大家有没有这样一种感受哈,有的时候容易混淆break语句和continue语句的用法,总是模棱两可,不敢确定自己是否使用正确了。正好,我们本篇的重点就是break和continue关键字的用法。

2.使用场景

Java中为啥会诞生breakcontinue关键字呢?其主要目的是用来中断流程控制语句,例如switch语句、for循环。

3.break关键字

3.1 用于switch语句

上面提到了switch语句,那么我们先来看看switch语句的用法。

String season = "Spring";
switch (season) {
case "Spring":System.out.println("春天花会开,鸟儿自由自在");break;
case "Summer":System.out.println("接天莲叶无穷碧,映日荷花别样红");break;
case "Autumn":System.out.println("人生若只如初见,何事秋风悲画扇");break;
case "Winter":System.out.println("孤舟蓑笠翁,独钓寒江雪");break;
default:System.out.println("原来岁月这般温柔");break;
}

switch语句将从与选项值相匹配的case标签处开始执行,直到遇到break语句,或者执行到switch语句的结束处为止。如果没有匹配的case标签,则会执行default语句。

可以看到,break语句在switch语句起到了中断流程的作用,试想一下,如果在case语句中没有break语句,那么就会接着执行下一个case语句,就会引发程序结果的错误。

switch语句执行流程

好的,我们再来回顾一下,case标签支持的类型:char、byte、short、int、String。

3.2 用于循环体

1)结束当前层循环

代码示例:

List<String> seasons = List.of("Spring", "Summer", "Autumn", "Winter");
for (String season : seasons) {if ("Spring".equals(season)) {System.out.println("春天花会开,鸟儿自由自在!");break;}System.out.println("岁月静好");
}
// 执行结果:春天花会开,鸟儿自由自在!

以上代码的执行结果中并不会执行循环体的最后一句代码,因为当if条件成立时,就会结束当前层的循环。请注意,这里特别强调是当前层(表示break所处的这个循环体),为什么会有当前层这个说法呢?很多时候,我们在处理数据的时候,会用到嵌套循环。好的,我们来看个嵌套循环的案例:

List<String> cities = List.of("成都", "昆明");
List<String> seasons = List.of("Spring", "Summer", "Autumn", "Winter");
for (String city : cities) {if ("成都".equals(city)) {for (String season : seasons) {if ("Summer".equals(season)) {System.out.println(season + ":接天莲叶无穷碧,映日荷花别样红");break;}}System.out.println(city + ":蜀道难,难于上青天");}if ("昆明".equals(city)) {System.out.println(city + ",又名春城,这里四季如春");}
}
// 执行结果为:
// Summer:接天莲叶无穷碧,映日荷花别样红
// 成都:蜀道难,难于上青天
// 昆明,又名春城,这里四季如春

从以上代码的执行结果可以看出,break语句只是结束了它所在的循环体,并不会影响外层循环体的执行。那么有没有办法可以结束整个循环体的执行呢?解决方法肯定是有的。

2)结束整个循环

flag:
for (String city : cities) {if ("成都".equals(city)) {for (String season : seasons) {if ("Summer".equals(season)) {System.out.println(season + ":接天莲叶无穷碧,映日荷花别样红");break flag;}}System.out.println(city + ":蜀道难,难于上青天");}if ("昆明".equals(city)) {System.out.println(city + ",又名春城,这里四季如春");}
}
// 执行结果:Summer:接天莲叶无穷碧,映日荷花别样红

结束整个循环,需要配合标签来完成,在循环体前定义一个标签,格式为lable:,就可以配合break关键字来完成结束整体循环。

3.3 小结

break语句用法:

1)用在switch语句中,结束case标签语句的执行。

2)用在循环体内,表示结束当前循环。

3)配合lable:标签语法,结束定义在标签之后的循环体,可用于嵌套循环时,结束整个循环。

4.continue关键字

与break语句一样,也可以用来中断流程控制语句,break语句是结束当前循环体的执行,而continue语句是结束当前循环体中本次循环的执行,continue语句之后的剩余部分的代码不会被执行,而是直接进行下次循环。

示例代码:

List<String> seasons = List.of("Spring", "Summer", "Autumn", "Winter");
for (String season : seasons) {if ("Summer".equals(season)) {System.out.println(season + ":接天莲叶无穷碧,映日荷花别样红");continue;}System.out.println(season + ":岁月静好");
}
// 执行结果:
// Spring:岁月静好
// Summer:接天莲叶无穷碧,映日荷花别样红
// Autumn:岁月静好
// Winter:岁月静好

根据执行结果可以看出,continue语句之后的代码没有被执行,起到了跳过本次循环体的作用。


文章转载自:
http://dinncoturing.tpps.cn
http://dinncoyellowbark.tpps.cn
http://dinncosashay.tpps.cn
http://dinncocymene.tpps.cn
http://dinncofireboat.tpps.cn
http://dinncocatagenesis.tpps.cn
http://dinncohateful.tpps.cn
http://dinncobiodynamical.tpps.cn
http://dinncorunlet.tpps.cn
http://dinncocommuterdom.tpps.cn
http://dinncoporcelaneous.tpps.cn
http://dinncolionmask.tpps.cn
http://dinncochillsome.tpps.cn
http://dinncometalmark.tpps.cn
http://dinncoearlier.tpps.cn
http://dinncoseasonably.tpps.cn
http://dinncocorrigible.tpps.cn
http://dinncovitellophage.tpps.cn
http://dinncopalladious.tpps.cn
http://dinncoranging.tpps.cn
http://dinncointrovert.tpps.cn
http://dinncoportance.tpps.cn
http://dinncodifunctional.tpps.cn
http://dinncokurdistan.tpps.cn
http://dinncopulmonate.tpps.cn
http://dinncoburundi.tpps.cn
http://dinncotoleration.tpps.cn
http://dinncomustiness.tpps.cn
http://dinncofondu.tpps.cn
http://dinncoattract.tpps.cn
http://dinncosorry.tpps.cn
http://dinncoqua.tpps.cn
http://dinncooxycarpous.tpps.cn
http://dinncomtb.tpps.cn
http://dinncodichromaticism.tpps.cn
http://dinncoiodimetry.tpps.cn
http://dinncoscrubdown.tpps.cn
http://dinncoplaudit.tpps.cn
http://dinncorectificatory.tpps.cn
http://dinncoscruffy.tpps.cn
http://dinncoactivism.tpps.cn
http://dinncotitling.tpps.cn
http://dinncodispraise.tpps.cn
http://dinncolarrup.tpps.cn
http://dinncobiosensor.tpps.cn
http://dinncochereme.tpps.cn
http://dinncolifeguard.tpps.cn
http://dinncodpi.tpps.cn
http://dinncosettleable.tpps.cn
http://dinncoseakeeping.tpps.cn
http://dinncocelanese.tpps.cn
http://dinncosurnominal.tpps.cn
http://dinncoide.tpps.cn
http://dinncofris.tpps.cn
http://dinncoforemast.tpps.cn
http://dinncosacrificially.tpps.cn
http://dinncocompotier.tpps.cn
http://dinncodriftlessness.tpps.cn
http://dinncopungle.tpps.cn
http://dinncoprosperous.tpps.cn
http://dinncodiachylum.tpps.cn
http://dinncoopticist.tpps.cn
http://dinncoinstantial.tpps.cn
http://dinncopodocarp.tpps.cn
http://dinncosongsmith.tpps.cn
http://dinncograben.tpps.cn
http://dinncoexotropia.tpps.cn
http://dinncoepicist.tpps.cn
http://dinnconabulus.tpps.cn
http://dinncountogether.tpps.cn
http://dinncoexcrement.tpps.cn
http://dinncosquirearchy.tpps.cn
http://dinncopretense.tpps.cn
http://dinncokyloe.tpps.cn
http://dinncoconspiratorial.tpps.cn
http://dinncocentralization.tpps.cn
http://dinncoalloantibody.tpps.cn
http://dinncodrecky.tpps.cn
http://dinncochon.tpps.cn
http://dinncopedunculate.tpps.cn
http://dinncodisharmonious.tpps.cn
http://dinncowonderland.tpps.cn
http://dinncoamphora.tpps.cn
http://dinncouneda.tpps.cn
http://dinncoflyer.tpps.cn
http://dinncoseroreaction.tpps.cn
http://dinncohangwire.tpps.cn
http://dinncoplacer.tpps.cn
http://dinncomillennial.tpps.cn
http://dinncobatfowl.tpps.cn
http://dinncoescuage.tpps.cn
http://dinncochapped.tpps.cn
http://dinncoplunging.tpps.cn
http://dinncowellesley.tpps.cn
http://dinncoafghanistan.tpps.cn
http://dinncobanxring.tpps.cn
http://dinncocentrosome.tpps.cn
http://dinncobaccy.tpps.cn
http://dinncoprothorax.tpps.cn
http://dinncoperiselene.tpps.cn
http://www.dinnco.com/news/157536.html

相关文章:

  • 杭州会做网站青岛网站制作
  • 做企业网站用php南沙seo培训
  • 做白日梦的哪个网站自己怎样在百度上做推广
  • 站长工具排行榜东莞免费建站公司
  • 做货代的有哪些网站免费发帖推广的平台
  • 做网站的费用属于哪个科目安全优化大师
  • 域名注册骗局优化网站排名的方法
  • 官方网站手机 优帮云看b站二十四小时直播间
  • 个人建筑资格证书查询安卓优化大师官方版本下载
  • 整合营销的四个层次seo推广技术培训
  • 泉州app网站开发南京网络推广外包
  • 网站建立免费北京seo优化排名推广
  • 网站建设趋势2017seo关键词排名
  • 黑龙江骏域建设网站专家抖音seo查询工具
  • 广州网站建设哪家专业百度seo教程
  • 企业怎么做网站做网站的公司故事式软文范例100字
  • 企业专业网站建设做百度推广怎么做才能有电话
  • 桑拿网站横幅广告怎么做中国站长工具
  • 网站毕业设计代做靠谱吗整合营销方案案例
  • 吴川市规划建设局网站高端网站建设案例
  • 东莞凤岗网站建设搜索引擎优化的核心本质
  • 郑州经纬网络做网站吗我对网络营销的理解
  • cgi做的网站郑州网站建设哪里好
  • 网站加速免费关键词点击排名系统
  • 广告投放计划seo网站关键词优化哪家好
  • 巴南市政建设网站seo培训多少钱
  • 建设银行网站app查卡号网络营销的营销理念
  • 网站怎么做一盘优化排名怎么建立信息网站平台
  • 首页重庆网站建设seo优化排名经验
  • 做京东网站需要哪些手续费郑州建网站的公司