找不到想要的文章嗎? 請直接再下面的搜尋框裡輸入要查詢文章內容關鍵字 ,就能夠更快速的取得想要閱讀的問題喔~~謝謝大家的支持與愛護～若有任何建議事項, 歡迎透過留言板留言給我喔！！
- Nov 14 Wed 2012 15:56
- Nov 06 Tue 2012 20:56
Just a quick question, how would you go about initializing a new ArrayList in a constructor which takes its values as parameters?
For example say I have a class which has an ArrayList of strings called bookings. I've already written a constructor which sets all fields to default values, so sets bookings to a new ArrayList of strings. However, the task I've been given is to write a second constructor which uses parameters to set the field values instead of setting them to defaults. This is fine for all my other fields, but how would I do this with the ArrayList?