java while循环教程:语句(while) 的知识详解
时间:2014-04-23 22:05 来源: 我爱IT技术网 作者:山风
语句(while)
while(条件表达式)
{
执行语句;
}
//打印1,3,5,7,9
class Test
{
public static void main(String[] args)
{
int x=1;
while(x<=10)
{
System.out.println("x="+x);
x+=2; //修改循环变量。Ctrl+C 强制结束循环
}
}
}
本文来源 我爱IT技术网 http://www.52ij.com/jishu/5550.html 转载请保留链接。
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
