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");
				}
			};

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM