打印空心正方形

需求:打印上面的空心正方形 思路:一、觀察規律。四周有*,其餘位置爲空。 二、利用加強for循環輸出,四周的位置用,其他位置輸出空格。 代碼: public class Square { public static void main(String[] args) { for (int i = 1; i <=10; i++) {//控制行輸出 for (int j =1; j <=10; j++)
相關文章
相關標籤/搜索