我已經創建了一類的基團,其包含字符串和布爾對象的命名擴展「配件」對象的ArrayList通過級Java
然後創建ArrayList類,然後將其添加到名爲「列表AccessoriesList「,從那裏輸入更多的數據。
然後我使用for循環創建了一個從ArrayList接收數據的附件對象。這仍然迴應爲空。
我環顧四周,發現最常見的問題是變量尚未初始化。所以,我想,仍然得到同樣的結果
所以這裏是配件類
public static class Accessories {
Accessories(String Accessoriesname, boolean cold, boolean warm, boolean hot, boolean rain, boolean snow, boolean ice, boolean formal, boolean informal) {
}
String name =null ; boolean cold; boolean warm; boolean hot; boolean rain; boolean snow; boolean ice; boolean formal; boolean informal;
}
這裏是AccessoriesList類
public ArrayList createAccessories() {
ArrayList<Accessories> Accessoriesist = new ArrayList<Accessories>();
Accessoriesist.add(new Accessories("Bag", true, true, true, false, false, false, true, true));
Accessoriesist.add(new Accessories("Gloves", true, false, false, true, true, true, true, true));
Accessoriesist.add(new Accessories("Hat", true, false, false, true, true, true, false, true));
Accessoriesist.add(new Accessories("Poncho", false, true, true, false, false, false, false, true));
Accessoriesist.add(new Accessories("Scarf", true, true, false, true, true, true, true, true));
Accessoriesist.add(new Accessories("Sunglasses", false, true, true, false, false, false, true, true));
Accessoriesist.add(new Accessories("Tie", true, true, true, true, true, true, true, true));
Accessories getAccessories =null;
String getname = null;
for (int i = 0; i < Accessoriesist.size(); i++) {
getAccessories = Accessoriesist.get(i);
getname = getAccessories.name;
System.out.println("this is the name : " + getname);
System.out.println("this is the Accessoriesist : " + Accessoriesist.get(i));
}
return Accessoriesist;
}
取而代之的接收信息,我收到散列碼。
我想拋出一個配件對象(原始)從ArrayList,到另一個配件對象(新)。我試圖拉從附件對象(新)