`
北风norther
  • 浏览: 14099 次
  • 性别: Icon_minigender_1
  • 来自: 邯郸
社区版块
存档分类
最新评论
收藏列表
标题 标签 来源
arrayslist.aslist(T...a)
package impotNew;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class test {

	public static void main(String[] args) {
		
		String[] strs = {"字符串0","字符串1","222222"};
		ArrayList<String> alist =new ArrayList<String>(Arrays.asList(strs));
		List<String> list= Arrays.asList(strs);
		//Exception in thread "main" java.lang.UnsupportedOperationException
		//list.add("song");
		alist.add("song");
		
		for(String str : alist){
			System.out.print(str+"  ");
		}
		System.out.println();
		for(String str : list){
			System.out.print(str+"  ");
		}
	}

}
Global site tag (gtag.js) - Google Analytics