【整理来源】黑马毕老师的java基础视频
例题:
----*
---* *
--* * *
_* * * *
* * * * *
<pre name="code" class="java">class ForForTest5 { public static void main(String[] args) { for(int x=0; x<5; x++)<span style="white-space:pre"> // { for(int y=x; y<5; y++)//尖向下 y=x { System.out.print("-"); } for(int z=0; z<=x; z++)<span style="white-space:pre"> </span> //* ,尖向上, { System.out.print("* "); } System.out.println(); } } }