嗨我正在一个项目上工作,我得到一个我无法解决的错误。从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