1. 首页
  2. 数据库
  3. 其它
  4. if语句 、switch语句 、for循环、break、continue、while、do while

if语句 、switch语句 、for循环、break、continue、while、do while

上传者: 2020-12-22 23:25:24上传 PDF文件 184.99KB 热度 37次
if语句 、switch语句 、for循环、break、continue、while、do-while总结 if语句 对比if语句switch语句 1、if语句作用的数据类型:boolean类型。而switch语句作用的类型:byte,short,int,char,String。 2、编码习惯:if适合分支较少的情况,switch适合分支较多的情况。 //1.if语句 if(条件表达式){ } //2.if...else语句:二选一 if(条件表达式){ 语句块1; }else{ 语句块2; } //3.多重if语句:多选一 if(条件1){//成立 语句块1; }el
用户评论