examples of abstract class in java programming

0

What is meant by Abstract class?

Answer: We can create the Abstract class by using the “Abstract” keyword before the class name. An abstract class can have both “Abstract” methods and “Non-abstract” methods that are a concrete class.

Abstract method:

The method which has only the declaration and not the implementation is called the abstract method and it has the keyword called “abstract”. Declarations ends with a semicolon.

Example:

public abstract class Manupulation{
public abstract void add();//Abstract method declaration
Public void subtract(){
}
}
  • An abstract class may have a non- abstract method also.
  • The concrete Subclass which extends the Abstract class should provide the implementation for abstract methods.

 

All Contributions

total contributions (0)

New to examplegeek.com?

Join us