嗨我正在一個項目上工作,我得到一個我無法解決的錯誤。從Eclipse程序的錯誤信息是:不適用於參數(void)錯誤
Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method add(String) in the type List is not applicable for the arguments (void) The method add(String) in the type List is not applicable for the arguments (void) ham cannot be resolved
at PizzaChoice.main(PizzaChoice.java:50)
那代碼:
System.out.print("\nDo you want thick base?");
input = keyboard.nextLine();
choice = input.charAt(0);
if (choice == 'y'){
pizza.thick.setCost(8.75);
pizza.thick.getType();
l.add(pizza.thick.getType());
c.add((double) pizza.thick.getCost());
totalPizzaBasePrice = totalPizzaBasePrice + pizza.thick.getCost();
'pizza.thick.getType()'和'pizza.thick.getCost()'的返回類型是什麼? –
爲什麼你有'pizza.thick.getType();'在自己的線?它應該是'setType()'? – vandale
它在PizzaBase.java – user3077730