package com.karl; public class loopnestedDemo { public static void main(String[] args) { //外部循环每循环一次,内部循环会全部执行完一轮 //嵌套循环 for (int i = 1; i <= 3; i++) { for (int j=1;j<=5;j++){ System.out.println("ko"+i); } System.out.println("-------------------------------"); } for (int i = 0; i <=3; i++) { for (int j = 1; j <= 4; j++) { System.out.print("*");//println换行 //print不换行 } System.out.println(); } } }
标签:String,int,嵌套,嵌套循环,循环,public From: https://www.cnblogs.com/Karl-hut/p/17437999.html