Answers for "abstract class means"

2

abstract class example in java

//abstract parent class
abstract class Animal{
   //abstract method
   public abstract void sound();
}
//Dog class extends Animal class
public class Dog extends Animal{

   public void sound(){
	System.out.println("Woof");
   }
   public static void main(String args[]){
	Animal obj = new Dog();
	obj.sound();
   }
}
Posted by: Guest on November-11-2020
2

is it necessary for abstract class to have abstract method

Abstract classes CAN have non-abstract methods.
Posted by: Guest on August-27-2021

Code answers related to "abstract class means"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language