我必須爲ArrayList創建一個構造函數。所以基本上我想要的是這個構造函數生成一個ArrayList。String []或ArrayList中的構造函數?
public Recipe(String[] modifications){
The problem is, it should give something like(example):
String[] modifications = [heatup, cooldown, mix, heatup]
將構造函數的工作是這樣的:
Recipe(heatup, cooldown, mix, heatup)
或者我需要將其更改爲somethign像:
Recipe(modifications){
this.myArrayList[1] = modifications[1]
.
.
.
}
謝謝你,對不起,如果有一些大的錯誤我的代碼,仍然在學習我的Java代碼。
呵呵,我覺得很蠢:p我知道Array和ArrayList之間的區別,但是,現在我深入瞭解這一切,我一直在想什麼:)我非常感謝這裏的所有人:)! –