我的代码只打印出一条直线,而我处于空白状态。有人可以向我解释一下我将如何做这个项目吗?
public class assigment04 {
public static void main(String[] args) {
int size = 5;
for (int row = 0; row < size; row++) {
for (int column = 1; column <= size; column++) {
if (row == column || column == (size + 1 - row)) {
System.out.println("*");
} else {
System.out.print(" ");
}
System.out.println();
}
}
}
}
MMTTMM
相关分类