zoukankan      html  css  js  c++  java
  • 字符串数组通过集合遍历

     1 package cn.collection.com;
     2 
     3 import java.util.ArrayList;
     4 import java.util.Iterator;
     5 import java.util.List;
     6 
     7 public class ListDemo3 {
     8 
     9     public static void main(String[] args) {
    10         // TODO Auto-generated method stub
    11         List ls = new ArrayList();
    12 
    13         String[] student = { "zhang", "san", "li", "si" };
    14         
    15         for (int y = 0; y < student.length; y++) {
    16             String st = student[y];
    17             ls.add(st); // 字符串数组放到集合中
    18         }
    19 
    20         Iterator it = ls.iterator();// 把集合遍历
    21         while (it.hasNext()) {
    22             String ss = (String) it.next();
    23             System.out.println(ss);
    24         }
    25 
    26     }
    27 
    28 }
  • 相关阅读:
    Tye exception
    DataSeeder
    angular
    认证Authentication
    MVC
    Ef Core
    工作单元
    VirtualFileSystem
    中间件
    日志
  • 原文地址:https://www.cnblogs.com/yschung/p/9303993.html
Copyright © 2011-2022 走看看