Question: abstract class Animal { abstract void makeSound ( ) ; void sleep ( ) { System.out.println ( Zzz ) ; } } class
abstract class Animal
abstract void makeSound;
void sleep
System.out.printlnZzz;
class Dog extends Animal
@Override
void makeSound
System.out.printlnWoof;
public class Main
public static void mainString args
Animal dog new Dog;
dog.makeSound;
dog.sleep;
What will be the output when the above code is executed?
point
Compilation error due to not implementing the abstract method makeSound in the Dog class
Woof
Zzz
Compilation error due to attempting to create an instance of an abstract class.
Compilation error due to attempting to access the private method sleep in the Animal class
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
