Answers for "abstract and interface in java"

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
1

java abstract vs interface

you can extend only one abstract class, but you can implement as much interfaces as you would need
Posted by: Guest on January-25-2021
1

abstract classes and interfaces in java

abstract class have no implementation of methods functions inside it. the classes which extending abstract class have to implement it
Posted by: Guest on December-30-2020

Code answers related to "abstract and interface in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language