Java2024/src/chapter2/Example19.java
2024-10-09 11:06:06 +08:00

19 lines
479 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package chapter2;
public class Example19 {
public static void main(String[] args) {
printRectangle(3, 5);
}
// 下面定义了一个打印矩形的方法接收两个参数其中height为高width为宽
public static void printRectangle(int height, int width) {
// 下面是使用嵌套for循环实现*打印矩形
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
}
}
}
}