What's new

Help PaHelp po mga master, rewrite code (Java) to compile

flex012

Forum Veteran
Elite
Joined
Nov 5, 2015
Posts
776
Reaction
2,502
Points
553
Patulong lang po mga masterhood ko ..
Abstract Classes and Polymorphism

Using the following class below:
  1. Rewrite the code so that it will compile

Java:
    interface Animal {

        public String eating();
        public int breathing();

}
    abstract class Mammal implements Animal{

        abstract public int sleeping();
        public String eating() { }

}
    class Cat extends Mammal{

}
    public class Main {

        public static void main(){

            Cat cat = new Cat();
            cat.eating();
            cat.breathing();
            cat.sleeping();

    }

}
 
Last edited:

Similar threads

Back
Top