赞
踩
循环有以下三种:
while、do...while、for
continue; 表示跳出本次循环,执行下一次循环
break; 表示跳出循环
return;后面的操作都不执行,直接返回
实际开发过程中,break和continue最好不要一起搭配使用。
三元表达式用法:1 > 0 ? "true" : "false";
switch case表示条件判断句
- package com.test;
-
- /**
- * @author Administrator
- * @date 2018/6/9
- */
- public class TestLogic {
-
- public static void main(String[] args) {
-
- String number = "一";
-
- switch (number) {
- case "一":
- System.out.println("1");
- break;
- case "二":
- System.out.println("2");
- break;
- default:
- System.out.println("默认");
- break;
- }
- }
- }

switch 判断的变量 在JDK1.7之前都只支持int类型,不支持字符串类型
在JDK1.7版本之后,可以支持字符串类型的变量判断。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。