what are abstract methods in Java?

Java 8Object Oriented ProgrammingProgramming

An abstract method is the one which has no definition and declared abstract.

In short, an abstract method contains only method signature without a body. To use this method, you need to inherit this method by extending the class and provide the method definition.


public abstract class Employee{
   private String name;
   private String address;
   private int number;
   public abstract double computePay();
Published on 08-Jan-2018 11:52:41