public class Example {????????public static void main ( String [] args ){????????????????System . out . println ( "Hello World" ); //1????????????????System . out . println ( "Hello World" ); //2????????????????System . out . println ( "Hello World" ); //3????????????????System . out . println ( "Hello World" ); //4????????????????System . out . println ( "Hello World" ); //5????????????????System . out . println ( "Hello World" ); //6????????????????System . out . println ( "Hello World" ); //7????????????????System . out . println ( "Hello World" ); //8????????????????System . out . println ( "Hello World" ); //9????????????????System . out . println ( "Hello World" ); //10????????}}
public class Example {????????public static void main ( String [] args ){????????????????int i = 0 ;????????????????while ( i < 10 ){????????????????????????System . out . println ( "Hello World" );????????????????????????i ++ ;????????????????}????????}}
while ( 循环条件 ){????????//循环操作}
public class Example3 {????????public static void main ( String [] args ) {????????????????//1.定义循环变量并赋初值????????????????int i = 0 ;????????????????//2.添加循环条件????????????????while ( i < 10 ){????????????????????????System . out . println ( i );????????????????????????//3.循环变量更新????????????????????????++ i ;????????????????}????????}}
public class Example4 {????????public static void main ( String [] args ) {????????????????int i = 0 ; // 定义循环变量并赋上初值????????????????while ( i < 100 ){ // 循环条件????????????????????????if ( i % 3 == 0 ){ // 能够被 3 整除????????????????????????????????System . out . println ( i );????????????????????????}????????????????????????i ++ ; // 循环变量的更新????????????????}????????}}
水仙花数解法参考文章:水仙花数(Java解法)-CSDN博客