Generalizations complaining I didn't create an object


class Coffee extends Beverage{
	public Coffee() {

	public void addSugar(int cubes) {

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


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

The code works without errors, but it won’t let me pass because it’s saying “Did you create the myOrder object within the main method?” …isn’t that exactly what I’ve done? What’s the problem?

There appears to be a missing method. This method call will be a deal breaker.

That method comes from the Beverage class which is given automatically.

We might have known that if we had a link to the exercise. Please post one, thanks.

It should amount to nothing, but do you see any irregularity in the way your above code reads? Perhaps the SCT does.

Sorry, here’s a link:

I notice when posted here that two of the lines appeared as spaces rather than tabs. I wonder if that was an issue. It didn’t look like there was any difference in the lesson’s IDE.

1 Like

When the code looks correct, the only thing I can turn to is the formatting. Just a guess, mind, so not anything expert. If one had the time, redoing all the structure manually, line by line, using only space characters (say 4?) might give some indication. It’s a time waster, though, given that indentation and whitespace should not be an issue, here.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.