Files
javaSE-0419/day03/src/com/inmind/control06/Demo15.java
2026-04-25 14:32:25 +08:00

27 lines
766 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 com.inmind.control06;
/*
循环的嵌套:外层循环执行一次,内层循环要执行一轮
*/
public class Demo15 {
public static void main(String[] args) {
//使用循环的嵌套实现时钟的效果一天有0~23小时每小时有0~59分
for (int i = 0; i < 24; i++) {//24小时
for (int j = 0; j < 60; j++) {//60分钟
System.out.println(i+""+j+"");
}
}
}
//5行5列的矩形
public static void method(String[] args) {
//请大家打印一个5行5列的*
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
System.out.print("*");
}
System.out.println();
}
}
}