Got stuck here


#1

class Coffee {

public Coffee() {

}

public void addSugar(int cubes) {

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

}

public static void main(String[] args) {
Coffee myOrder = Coffee(3);

}

}

Error message is under

Coffee.java:14: error: cannot find symbol
Coffee myOrder = Coffee(3);
^
symbol: method Coffee(int)
location: class Coffee
1 error


#2

The code all looks fine until you get to this line:

The aim here is to create the coffee class, create a new instance of the class (myOrder) and then call the method addSugar. The main issue with the line above is that you're passing 3 into coffee, and not into the method.

To create the new instance we would need to create a new instance and then call the addSugar method

Coffee myOrder = new Coffee();
myOrder.addSugar(3);