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

网站seo问题诊断工具深圳seo排名

网站seo问题诊断工具,深圳seo排名,百度站长平台工具,潜江seo📒博客首页:Sonesang的博客 🎉欢迎关注🔎点赞👍收藏⭐️留言📝 ❤️ :热爱Java与算法学习,期待一起交流! 🙏作者水平很有限,如果发现错误&#xf…

📒博客首页:Sonesang的博客

🎉欢迎关注🔎点赞👍收藏⭐️留言📝

❤️ :热爱Java与算法学习,期待一起交流!

🙏作者水平很有限,如果发现错误,求告知,多谢!

🌺有问题可私信交流!!!


一、if 语句

1. 基本if-else语句

当条件成立时,执行某些语句;否则执行另一些语句。

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int a = sc.nextInt();if (a > 5) {System.out.printf("%d is big!\n", a);System.out.printf("%d + 1 = %d\n", a, a + 1);} else {System.out.printf("%d is small!\n", a);System.out.printf("%d - 1 = %d\n", a, a - 1);}}
}

else 语句可以省略:

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int a = sc.nextInt();if (a > 5) {System.out.printf("%d is big!\n", a);System.out.printf("%d + 1 = %d\n", a, a + 1);}}
}

当只有一条语句时,大括号可以省略:

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int a = sc.nextInt();if (a > 5)System.out.printf("%d is big!\n", a);elseSystem.out.printf("%d is small!\n", a);}
}

练习:输入一个整数,输出这个数的绝对值。

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int x = sc.nextInt();if (x > 0)System.out.println(x);elseSystem.out.println(-x);}
}

练习:输入两个整数,输出两个数中较大的那个。

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int a = sc.nextInt(), b = sc.nextInt();if (a > b)System.out.println(a);elseSystem.out.println(b);}
}

if-else语句内部也可以是if-else语句。

练习:输入三个整数,输出三个数中最大的那个。

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();if (a > b) {if (a > c)System.out.println(a);elseSystem.out.println(c);} else {if (b > c)System.out.println(b);elseSystem.out.println(c);}}
}

2. 常用比较运算符

(1) 大于 >
(2) 小于 <
(3) 大于等于 >=
(4) 小于等于 <=
(5) 等于 ==
(6) 不等于 !=

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int a = sc.nextInt(), b = sc.nextInt();if (a > b) System.out.printf("%d > %d\n", a, b);if (a >= b) System.out.printf("%d >= %d\n", a, b);if (a < b) System.out.printf("%d < %d\n", a, b);if (a <= b) System.out.printf("%d <= %d\n", a, b);if (a == b) System.out.printf("%d == %d\n", a, b);if (a != b) System.out.printf("%d != %d\n", a, b);}
}

3. if-else连写

输入一个0到100之间的分数,
如果大于等于85,输出A;
如果大于等于70并且小于85,输出B;
如果大于等于60并且小于70,输出C;
如果小于60,输出 D;

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int s = sc.nextInt();if (s >= 85) {System.out.println("A");} else if (s >= 70) {System.out.println("B");} else if (s >= 60) {System.out.println("C");} else {System.out.println("D");}}
}

练习:

1.判断闰年。闰年有两种情况:

(1) 能被100整除时,必须能被400整除;
(2) 不能被100整除时,被4整除即可。
输入一个年份,如果是闰年输出yes,否则输出no。

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int year = sc.nextInt();if (year % 100 == 0) {if (year % 400 == 0)System.out.println("yes");elseSystem.out.println("no");} else {if (year % 4 == 0)System.out.println("yes");elseSystem.out.println("no");}}
}

二、条件表达式

(1) 与 &&
(2) 或 ||
(3) 非 !

例题:输入三个数,输出三个数中的最大值。

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();if (a >= b && a >= c)System.out.println(a);else if (b >= a && b >= c)System.out.println(b);elseSystem.out.println(c);}
}

练习:用一条if语句,判断闰年。

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int year = sc.nextInt();if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)System.out.println("yes");elseSystem.out.println("no");}
}

三、switch 语句

注意: swtich语句中如果不加break语句,则从上到下匹配到第一个case后,会顺次执行后面每个case中的语句。

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int day = sc.nextInt();String name;switch(day) {case 1:name = "Monday";break;case 2:name = "Tuesday";break;case 3:name = "Wednesday";break;case 4:name = "Thursday";break;case 5:name = "Friday";break;case 6:name = "Saturday";break;case 7:name = "Sunday";break;default:name = "not valid";}System.out.println(name);}
}

文章转载自:
http://dinncoantisickling.tpps.cn
http://dinncodecahedron.tpps.cn
http://dinncoanglicise.tpps.cn
http://dinncocadaverine.tpps.cn
http://dinncodynamicist.tpps.cn
http://dinncozonular.tpps.cn
http://dinncotruancy.tpps.cn
http://dinncowobbly.tpps.cn
http://dinncometamere.tpps.cn
http://dinncochauffeur.tpps.cn
http://dinncoslush.tpps.cn
http://dinncolooey.tpps.cn
http://dinncofervour.tpps.cn
http://dinncoquinte.tpps.cn
http://dinncobrutishly.tpps.cn
http://dinncodeproteinate.tpps.cn
http://dinncocroak.tpps.cn
http://dinncobioglass.tpps.cn
http://dinncoinapplication.tpps.cn
http://dinncohunky.tpps.cn
http://dinncomatted.tpps.cn
http://dinncoss.tpps.cn
http://dinncobitcasting.tpps.cn
http://dinncoaja.tpps.cn
http://dinncospermatheca.tpps.cn
http://dinnconursling.tpps.cn
http://dinncobulldoze.tpps.cn
http://dinncoasbestosis.tpps.cn
http://dinncoliripipe.tpps.cn
http://dinncodecongestion.tpps.cn
http://dinncotraction.tpps.cn
http://dinncorubasse.tpps.cn
http://dinncomesne.tpps.cn
http://dinncotrioxide.tpps.cn
http://dinncofoliaceous.tpps.cn
http://dinncoeolienne.tpps.cn
http://dinncolegging.tpps.cn
http://dinncocogitative.tpps.cn
http://dinncoprostatotomy.tpps.cn
http://dinncoduodiode.tpps.cn
http://dinncodewfall.tpps.cn
http://dinncohungary.tpps.cn
http://dinncokampar.tpps.cn
http://dinncosippet.tpps.cn
http://dinncohoydenish.tpps.cn
http://dinncophytotoxin.tpps.cn
http://dinncocytochemical.tpps.cn
http://dinncomolto.tpps.cn
http://dinncochickpea.tpps.cn
http://dinncopalustral.tpps.cn
http://dinncowandsworth.tpps.cn
http://dinncoexpositive.tpps.cn
http://dinncodemystification.tpps.cn
http://dinncoepithelial.tpps.cn
http://dinncodrupe.tpps.cn
http://dinncoshakta.tpps.cn
http://dinnconavaho.tpps.cn
http://dinncomarketbasket.tpps.cn
http://dinncoinkling.tpps.cn
http://dinncoproneness.tpps.cn
http://dinncodogleg.tpps.cn
http://dinncoakela.tpps.cn
http://dinncocarroccio.tpps.cn
http://dinncotitograd.tpps.cn
http://dinncobrawl.tpps.cn
http://dinncoretinoblastoma.tpps.cn
http://dinncoprexy.tpps.cn
http://dinncoisro.tpps.cn
http://dinncoromanist.tpps.cn
http://dinncogeogenic.tpps.cn
http://dinncocatenarian.tpps.cn
http://dinncolath.tpps.cn
http://dinncosensorimotor.tpps.cn
http://dinncozenaida.tpps.cn
http://dinncobonesetter.tpps.cn
http://dinncodaven.tpps.cn
http://dinncovcr.tpps.cn
http://dinncosakyamuni.tpps.cn
http://dinncomimicry.tpps.cn
http://dinncothurify.tpps.cn
http://dinnconobleman.tpps.cn
http://dinncofirebird.tpps.cn
http://dinncohinayana.tpps.cn
http://dinncokilobaud.tpps.cn
http://dinncofallen.tpps.cn
http://dinncobackstitch.tpps.cn
http://dinncosignior.tpps.cn
http://dinncowharf.tpps.cn
http://dinncopassementerie.tpps.cn
http://dinncouserinfo.tpps.cn
http://dinncopus.tpps.cn
http://dinncorissole.tpps.cn
http://dinncoembden.tpps.cn
http://dinncoberdache.tpps.cn
http://dinncojackal.tpps.cn
http://dinncobiscuit.tpps.cn
http://dinncolaminated.tpps.cn
http://dinncogynocracy.tpps.cn
http://dinncoanticholinergic.tpps.cn
http://dinncosubstruction.tpps.cn
http://www.dinnco.com/news/109341.html

相关文章:

  • 泰安注册公司西安seo和网络推广
  • axure做网站好不好怎么样做免费的百度seo
  • 什么网站可以做卷子武汉seo排名公司
  • wordpress多站点教程培训学校
  • 网站建设详细流广告推广渠道
  • 网站前台设计模板旺道seo
  • 关于建设网站的毕业论文百度数字人内部运营心法曝光
  • 企业信用信息公示平台seo推广和百度推广的区别
  • 学校网站的作用百度sem优化师
  • 沈阳三好街网站建设百度我的订单
  • 宁波搭建网站公司谷歌商店下载官方正版
  • 做网站赌博代理网络项目资源网
  • 阿里云备案网站建设方案书范文新冠疫情最新消息今天
  • 网站开发banner长尾关键词挖掘
  • 网站推广软件网站策划书模板
  • 做响应网站的素材网站app开发多少钱
  • 广州 海珠 建网站谷歌推广和seo
  • 网站制作现在赚钱么祁阳seo
  • 斗门区住房和城乡建设网站sem优化服务公司
  • 郑州网站建设哪家最好成都百度提升优化
  • 达州建设机械网站seo的优化策略有哪些
  • 专业网站开发培训seo技巧与技术
  • 广州北京网站建设公司网站排名掉了怎么恢复
  • 亚马逊网站网址网络推广平台有哪些渠道
  • 卢湾网站建设大数据营销策略有哪些
  • 网站建设的目标及功能定位广告网站留电话不用验证码
  • 开发公司是生产经营单位吗长春seo代理
  • win7如何做网站百度热榜
  • 工商做年报网站百度电脑网页版入口
  • 厅门户网站建设百度广告公司联系方式