/*
*
**
***
****
*****
*/
class ForForTest2
{
public static void main(String[] args)
{
for (int x=0 ; x<5 ; x++ )
{
for (int y=5-x;y<=5;y++)
{
System.out.print("*");
}
System.out.println();
}
}
}
这段代码中第二个for循环中,for中最后一个表达式y++,有什么具体的含义么? 我觉得并没有什么含义。因为for(int y=5-x;y<=5;y++)中并没有什么具体意义。
后来看懂了。想法有点误区。现在纠正了。