我正在寫一個計算機股票程序,它允許用戶定義和顯示一個數組中的一種計算機。此刻打印一個數組中的一臺計算機(例如,第一個數組),但並不是所有特定模型的列表。打印ArrayList
model = Console.askString("A or B ? ");
item = mlist.find(model);
if (item == null)
System.out.println("Cannot find " + model);
else
item.print("Laptop details...");
break;
什麼是'mlist'? 'find'會返回所有匹配,還是隻返回第一個? – 2013-05-06 13:00:05
什麼是'item'?請提供更多相關部分。 – Maroun 2013-05-06 13:00:09
你可以發佈你得到的輸出和你期望的輸出嗎? – 2013-05-06 13:01:40