public class HelloWorld{ public static void main(String[] args){ System.out.println("打印正方形"); for (int i = 1;i <= 4; i++){ for(int j = 1; j <= 4; j++ ){ System.out.println("*"); } System.out.println(); } }}
2 回答
已采纳

冰山点水
TA贡献109条经验 获得超149个赞
public class HelloWorld { public static void main(String[] args) { System.out.println("打印正方形"); for (int i = 1; i <= 4; i++) { for (int j = 1; j <= 4; j++) { System.out.print("*");//这里用print而不是println,不然打印一个*就会换行一次 } System.out.println(); } } }
添加回答
举报
0/150
提交
取消