首页 > 代码库 > 05.循环语句

05.循环语句

  • for循环
  1. publicclassTestFor{
  2. publicstaticvoid main(String args[]){
  3. for(int i =0; i < 10; i++){
  4. System.out.println(i);
  5. }
  6. }
  7. }
 
  • whlie循环
  1. publicclassTestWhile{
  2. publicstaticvoid main(String args[]){
  3. int i =0;
  4. while(i <10){
  5. System.out.println(i);
  6. i++;
  7. }
  8. }
  9. }



来自为知笔记(Wiz)



05.循环语句