首页 > 代码库 > for each

for each

 1 public class Tforeach { 2  3     /** 4      * @param args 5      */ 6     public static void main(String[] args) { 7         // TODO Auto-generated method stub 8  9     10     String [] s=new String[]{"123","321","456"};11     for(String i:s){//将数组s的每一个值从s[0]起赋值给 相应类型的 i 循环至遍历12         System.out.println(i+"\t");13     }14         15 16 }17 }

 

for each