public class Main {
public static void main(String[] args) {
String[] burgerIngredients = new String[2];
burgerIngredients[0]= new String("alu");
burgerIngredients[1]= new String("Potato");
Burger burger1 = new Burger("Classic Burger", burgerIngredients, 5.99, 550, 1);
burger1.showdetails();
}
}
我尝试了数组概念。我应该怎么做才能获得带有成分名称的输出?
You can use get method to print all ingredient details.
public String[] getIngredients() {
return ingredients;
}
It would be helpful if you can show burger class like using showdetails() u wanted to print ingredient details?