public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String a="*******";
int i=1;
int j=a.length();
while(i<=a.length())
{
System.out.println(a.substring(0,i));
i=i+2;
}
while(j>1)
{
System.out.println(a.substring(0,j-2));
j=j-2;
}
}
}
以上代码打印的是半个棱形,谁能把另一半打印出来?
*
***
*****
*******
*****
***
* |
|