java--新建list 并赋值

数组初始化 时候的赋值

String[] strings = new String[]{
              "one","two","three"
        };

  

list 初始化时候的赋值

List<String> a = new ArrayList<String>() {//这个大括号 就相当于我们  new 接口
				{//这个大括号 就是 构造代码块 会在构造函数前 调用
					this.add("ZBP3100019");	
					this.add("ZBP3100019");
					this.add("ZBP3100019");	
					this.add("ZBP3100019");
					this.add("ZBP3100019");	
					this.add("ZBP3100019");
					this.add("ZBP3100019");	
					this.add("ZBP3100019");
				}
			};

  

原文地址:https://www.cnblogs.com/llq1214/p/11383075.html