java语句(for嵌套)教程-java读书笔记
时间:2014-04-23 22:16 来源: 我爱IT技术网 作者:山风
语句(for嵌套)
class Test
{
public static void main(String[] args)
{
for(int x=0;x<3;x++)
{
for(int y=0;y<4;y++)
{
System.out.print("*");
}
System.out.println();
}
System.out.println("- - - - - -");
for(int x=0;x<5;x++)
{
for(int y=x;y<5;y++)
{
System.out.print("*");
}
System.out.println();
}
}
}
返回结果:
****
****
****
- - - - - -
*****
****
***
**
*
本文来源 我爱IT技术网 http://www.52ij.com/jishu/5556.html 转载请保留链接。
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
