Issue with Coffee exercise on Java


#1

Can't see what I am doing wrong, must be bleary eyes.

class Coffee extends Beverage {

public Coffee() {

}


public void addSugar(2) {

	System.out.println("You added " + cubes + " sugar cubes.");

}

public static void main(String[] args) {

Coffee myOrder = new Coffee();
myOrder.addSugar(2);
myOrder.isFull();

}

}

Get error:

Coffee.java:7: error: illegal start of type
public void addSugar(2) {

                     ^

1 error

It's something simple I am sure, just can't see it.

Thanks in advance


#2

@justjeff25,
Assuming that you have read
https://docs.oracle.com/javase/tutorial/java/javaOO/classdecl.html
https://docs.oracle.com/javase/tutorial/java/javaOO/variables.html
https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html
https://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html
https://docs.oracle.com/javase/tutorial/java/javaOO/objectcreation.html
https://docs.oracle.com/javase/tutorial/java/javaOO/usingobject.html
https://docs.oracle.com/javase/tutorial/getStarted/application/

you have to modify your addSugar() Method,
in a Method taking 1 PARAMETER int cubes
then you will be able to call the addSugar() Method providing 1 ARGUMENT int Value 2