13. Generalizations - 4


Can anyone explain me how to do the last point, please?



Is your main method misspelled? Looks right to me, but some special characters perhaps? Can you post your code so I can look at that?

Because if it is misspelled, it'll inherit a main from the Beverage class, and that main method is empty, which explains the empty console.

You can also just delete the main method in the Beverage class, so that it definitely can't be causing this. If there's something wrong, you should now get an error message with more information instead of just a blank screen - which would be great.


Here's the code, and apparently I found out how to solve it, but I don't understand why, can you help me?

public static void main(String[] args) {

Coffee myOrder = new Coffee();



You mean you accidentally solved it without finding out how :stuck_out_tongue:

My best guess is that the other main method was running, maybe you had that tab active when you ran the program.

A Java program requires an entry point (main method) and if it's missing there would be an error message. And if your main ran, it would either crash, or print something - right, it has to be either this or something even less your fault.

@gilbertohdz I saw you post about some other Java bug, so if you're still around, please take this as a bug report and a suggestion to remove Beverage.main since it appears to serve no purpose and can lead to this very confusing situation where nothing happens with no feedback.


Its your last line.

In your original you wrote:
int isFull = myOrder.isFull();

In the correct version you wrote:

IsFull has already been created; in your first version it looks like you are trying to create something new.
So therefore when you call upon a method which already is there (its in the Beverage class), then you only need to call upon it in the way above - not create a new one.

Hope this helps!!