Storageという名前のクラスがあります。Storage には、Products と呼ばれる特別なオブジェクトの配列リストが含まれています。各製品には、名前、価格などの情報が含まれています。私のコードは次のとおりです。
class Storage{
Product sprite = new Product("sprite",1.25,30);
Product pepsi = new Product("pepsi",1.85,45);
Product orange = new Product("orange",2.25,36);
Product hershey = new Product("hershey",1.50,33);
Product brownie = new Product("brownie",2.30,41);
Product apple = new Product("apple",2.00,15);
Product crackers = new Product("peanut",3.90,68);
Product trailmix = new Product("trailmix",1.90,45);
Product icecream = new Product("icecream",1.65,28);
Product doughnut = new Product("doughnut",2.75,18);
Product banana = new Product("banana",1.25,32);
Product coffee = new Product("coffee",1.30,40);
Product chips = new Product("chips",1.70,35);
ArrayList<Product> arl = new ArrayList<Product>();
//add initial elements to arraylist
arl.add(sprite);
arl.add(pepsi);
arl.add(orange);
arl.add(hershey);
arl.add(brownie);
arl.add(apple);
arl.add(peanut);
arl.add(trailmix);
arl.add(icecream);
arl.add(doughnut);
arl.add(banana);
arl.add(coffee);
arl.add(chips);
}
コンパイルするたびに、141 ~ 153 行目に<identifier> expected
. 初歩的な問題であることはわかっていますが、これを理解できないようです。どんな助けでも大歓迎です。