Neeed help Jaava Generalizations


#1

Why don’t we make methods in the beverage class and only call them in the coffee class?

Coffee class

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);
    myOrder.isFull();

	}
}

Class beverage

class Beverage {
	
	public Beverage() {

	}

	public void isFull() {

		System.out.println("Your order is full!");

	}

	public static void main(String[] args) {

	}

}