For and While loop choice.
/*
Difference between 'for' and 'while'.
We can transform everything between 'for' and 'while'.
if the incremnet is just use for increase,we recommended 'for';
but if we want to preserved the increment and use it after the loop,'while' is recommented.
*/
import kju.print.Print;
class ForWhile
{
public static void main(String[] args)
{
/*
'i' is created after 'for',so it was release after the close brace.
*/
for(int i = 0; i < 3; i++) {
Print.println("i = " + i);
}
/*
i = 0
i = 1
i = 2
*/
//Print.println("after the loop, i = " + i); //compile error,i does not exist. Print.println("-----------");
/*
'j' is created before 'while',so it was preserved after the close brace.
*/
int j = 0;
while(j < 3){
Print.println("j = " + j);
j++;
}
/*
j = 0
j = 1
j = 2
*/
Print.println("after the loop, j = " + j);
//after the loop, j = 3
}
}
For and While loop choice.的更多相关文章
- Zabbix agent 在windows上安装部署
Zabbix agent 在windows上安装部署 1.下载与解压 地址: http://www.zabbix.com/downloads/2.4.4/zabbix_agents_2.4.4.win ...
- 识别简单的答题卡(Bubble sheet multiple choice scanner and test grader using OMR, Python and OpenCV——jsxyhelu重新整编)
该博客转自www.pyimagesearch.com,进行了相关修改补充. Over the past few months I've gotten quite the number of reque ...
- Atitit 解决Unhandled event loop exception错误的办法
Atitit 解决Unhandled event loop exception错误的办法 查看workspace/.metadata/.log org.eclipse.swt.SWTError: No ...
- Looper.prepare()和Looper.loop()
什么时候需要 Looper Looper用于封装了android线程中的消息循环,默认情况下一个线程是不存在消息循环(message loop)的,需要调用Looper.prepare()来给线程创建 ...
- PostgreSQL-PL/pgSQL-cursor,loop
将spam_keyword表word字段的字符全部拆分,只是利用过程语言完成循环的操作而已. create or replace function proc1() returns setof text ...
- archlinux 加载loop模块,且设定loop设备个数
如果loop模块没有编译进内核就要先加载loop模块 modprobe loop 然后更改/etc/modprobe.d/modprobe.conf(有些文章写是在/etc/modprobe.conf ...
- 工作邮件loop的用法
examples come from native speaker Put john in the loop about this. He will have good advice. Why hav ...
- bat脚本参数 if goto choice for使用的学习笔记。
写过几次bat脚本,但一直没有总结,最近找到一个网页介绍bat,总结得很好,转自 http://www.jb51.net/article/49627.htm: 本文只总结我不会的,全面的看原网页就可以 ...
- VMWare虚拟机实例拷贝到另一台服务器后出现Error in the RPC receive loop: RpcIn: Unable to send.错误的解决
把一个VMWare虚拟机实例拷贝到另一台服务器后,在事件查看器中的应用程序日志中不断出现Error in the RPC receive loop: RpcIn: Unable to send.错误, ...
随机推荐
- iOS-NSString-Base64String-Base64原理
之前看到好多人找Str2Base64Str,还有好多自己写了方法的,仔细研究了下base64的编码原理(这个我写在下面),发现官方的API已经可以完成这项功能,这里贴出来供大家参考. 一言不合就上代码 ...
- 介绍一个好用的软件--多个WIN远程连接
MultiDesk v3.162015-03-16 http://www.syvik.com/multidesk/index_chs.htm MultiDesk 是一个选项卡(TAB标签)方式的远程桌 ...
- Android网络框架Volley(体验篇)
Volley是Google I/O 2013推出的网络通信库,在volley推出之前我们一般会选择比较成熟的第三方网络通信库,如: android-async-http retrofit okhttp ...
- 【HDOJ】1811 Rank of Tetris
并查集+拓扑排序.使用并查集解决a = b的情况. #include <iostream> #include <cstdio> #include <cstring> ...
- WordPress Xhanch - My Twitter插件跨站请求伪造漏洞(CVE-2013-3253)
漏洞版本: WordPress Xhanch - My Twitter Plugin 2.7.5 漏洞描述: Bugtraq ID:61629 CVE ID:CVE-2013-3253 WordPre ...
- 有关Spring Batch
在使用Spring Batch时,在无法实现StepListener的情况下,如何使用ExecutionContext呢. 解决办法,使用宣言@BeforeStep或@AfterStep.
- 像素,分辨率,PPI(像素密度),BPP 扫盲
像素于分辨率 像素,又称画素,为图像显示的基本单位,译自英文“pixel”,pix是英语单词picture的常用简写,加上英语单词“元素”element,就得到pixel,故“像素”表示“图像元素”之 ...
- 安装MongoDB -- Windows平台
1. 安装MongoDB 2. 添加环境变量 将安装后的bin目录,添加至系统的Path环境变量中,例如我的安装路径为"C:\Program Files\MongoDB\Server\3.2 ...
- C# 数组排序 基本算法 分类: C# 2014-09-25 15:43 129人阅读 评论(0) 收藏
说明:冒泡.直接插入.选择.自带方法四中基本排序算法. using System; using System.Collections.Generic; using System.ComponentMo ...
- IAAS云计算产品畅想-公有云主机产品优势
关于云计算的优势介绍真是太多太多了,但是说实话准确性欠妥. 云计算也是有很多细分的: 公有云.私有云.混合云 IAAS.PAAS.SAAS 园区云.行业云(医疗云.教育云等等) 说起优点来,绝对不能一 ...