gongxr

 

 1 package basic;
 2 //数组遍历方法
 3 public class ForEach {
 4 
 5     public static void main(String[] args) {
 6         // 原始数组
 7         String strs[] = { "a", "b", "c", "d" };
 8         
 9         // 数组输出常规方法
10         for (int x = 0; x < strs.length; x++) {
11             System.out.print(strs[x] + "、");
12         }
13         System.out.println(" ");
14         // foreach输出-遍历数组
15         for (String s : strs) {
16             System.out.print(s + "、");
17         }
18     }
19 
20 }

 

分类:

技术点:

相关文章:

  • 2022-02-24
  • 2021-10-05
  • 2022-12-23
  • 2021-09-30
  • 2021-04-02
  • 2021-10-08
  • 2022-02-04
  • 2022-01-08
猜你喜欢
  • 2021-08-03
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
  • 2021-10-19
相关资源
相似解决方案