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.错误, ...
随机推荐
- MockupBuilder
玩一下,想起了以前公司产品经理作的些事了...
- xstream 别名的用法<转>
1.xstream的alias使用方法: 1.1 作用:将序列化中的类全量名称,用别名替换. 1.2 使用方法:xstream.alias("blog", Blog.class) ...
- 解除網頁無法選取文字、鎖右鍵限制:Enable Copy(Chrome 擴充套件)
有些网页因会因为某些因素而禁止浏览者直接复制网页上的内容,虽然我们了解站方的意思,不过有些时候会造成一些不必要的困扰. Enable Copy 这款Chrome 扩充套件可以帮你一键解除封锁右键和选取 ...
- 经典的单例模式c3p0来控制数据库连接池
package com.c3p0.datapools; //数据库连接池 单例模式 import java.sql.Connection; import java.sql.SQLException; ...
- 14.6.7 Configuring the Number of Background InnoDB IO Threads 配置InnoDB IO Threads的数量
14.6.7 Configuring the Number of Background InnoDB IO Threads 配置InnoDB IO Threads的数量 InnoDB 使用后台线程来服 ...
- page.Response.WriteFile(newpath);
page.Response.Clear(); page.Response.ClearHeaders(); page.Response.Buffer = fa ...
- 在多台服务器上简单实现Redis的数据主从复制
Redis的主从复制功能非常强大,一个master可以拥有多个slave,而一个slave又可以拥有多个slave,如此下去,形成了强大的多级服务器集群架构.下面我演示下怎样在多台服务器上 ...
- 中国版 Azure 现提供 Azure Traffic Manager
Stephen MaloneAzure网络 - DNS和 Traffic Manager高级项目经理 我们非常高兴地宣布,中国版 Azure中现已提供 Azure Traffic Manager.Az ...
- 利用纯java捕获和播放音频
参考: 1.http://www.cjsdn.net/doc/jdk60/javax/sound/sampled/package-summary.html 2.http://www.cjsdn.net ...
- TCP Socket的通讯框架
http://www.oschina.net/p/simple-socketshttp://www.oschina.net/p/cwsshttp://www.oschina.net/p/tcpprox ...