what is abstractclass in java code example
Example 1: What are abstract methods in java
An abstract method is the method which does’nt have any body.
Abstract method is declared with
keyword abstract and semicolon in place of method body.
public abstract void <method name>();
Ex : public abstract void getDetails();
It is the responsibility of subclass to provide implementation to
abstract method defined in abstract class
Example 2: how to use an abstract class in java
interface methods{
public void hey();
public void bye();
}
abstract class other implements methods{
public void hey(){
System.out.println("Hey");
}
}
class scratch implements methods {
public void hey(){
System.out.println("Hey");
}
public void bye() {
System.out.println("Hey");
}
}