📄 squareboard.java
字号:
// Exercise 3.6
public class SquareBoard { // Saved as "SquareBoard.java"
public static void main (String[] args) {
int size = 5; //the size of the square board
//print the board using 2 For loops
for (int row = 0; row <= size; row++) {// print the row of the board
for (int col = 0; col <= size; col++) {// print the col of the board
System.out.print("# "); // print without newline
}//all together print 5(size) "#"s at the end of the inner loop
System.out.println(); // for printing newline
}//all together print 5(size) lines at the end of the outer loop
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -