While循环作业
- 使用while输出10个“我在学java”,有条件的 断点 调试,录视频;EV录屏;(20分)
- 使用亿图图示,针对whiel循环绘制流程图;
- 分析代码:
public static void main(String[]args){ int i=1; boolean b=false; if(b && ++i ==2){ System.out.println(“first”+i); }else{ System.out.println(“second”+i); } } } |
编译运行结果为:
- first:1 B.first:2 C.second:1 D.second:2
- 分析代码,第三题的简化版。
public static void main(String[]args){ int a=3,b=4,c=8; if(++a==b){ System.out.println(++a); }else{ System.out.println(a++); } } } |
编译运行结果为:
A 5 B.4 C.编译错误 D.编译通过、没有任何输出
- 三元运算符ex1?ex2:ex3,相当于下面的( )语句。
- if(ex1)ex2;else ex3;
- if(ex2)ex1; else ex3;
- if(ex1)ex3;else ex3;
- if(ex3)ex2;else ex1;
- 求1-100之内的数字和;
这道题,一定要把步骤给分析清楚,写到代码注释或纸上,拍照提交。
知道你100%的理解了。