Need your help please


#1

Hello everyone,
I’m a beginner here and I’ve just learnt Java for 2 days
For this exercise, I don’t get why I have to creat the class Beverage, why I can’t just public isFull
Thank you!

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();
               myOrder.addSugar(2);
    
              class Beverage{
        
    	      public void isFull(){   
             System.out.println("Full order");      
             }      
    }    
          myOrder.isFull();  
  }  
}

#2

Something looks fishy, here. Are you sure that Beverage class is in the right place?


#3

Yes I’m sure. It works and allows me to pass.