String[]遍历

 public static void main(String[] args) {
          // 数组遍历
          System.out.println("1 数组遍历");
         String[] str1 = { "数", "组", "遍", "历" };
          arrayTravelse(str1);
         System.out.println("===================");

}

 

// 数组遍历
      private static void arrayTravelse(String[] str) {
          for (int i = 0; i < str.length; i++) {
              String j = str[i];
              System.out.print(j + " ");
          }
          System.out.println();
      }

posted on 2019-02-21 09:18  城市小农民  阅读(399)  评论(0编辑  收藏  举报

导航