public static void main(String[] args) {
String n = JOptionPane.showInputDialog("请输入一个数字:");// 直接输入行号
int l = Integer.parseInt(n);
int k = l;
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= l; j++)
System.out.print(" ");
l--;
for (int j = 1; j <= i*2-1; j++) {
System.out.print("*");// 显示星星
}
System.out.println();
}
}