T E C h O C E A N H U B

Abstraction in Java

Abstraction is the process of hiding the implementation details and  showing the required functionality to the user.

In Java abstraction is achieved through abstract classes and interfaces.

Some Features of abstract classes.

  1. In abstract class there are both abstract and non abstract methods.
  2. These classes cannot be instantiated.
  3. These classes  uses abstract keyword in order to declare a class as abstract.
  4. Abstract classes also uses extend keyword like normal classes.

Some features of Interfaces.

  1. All the methods in interface are by default abstract, you don’t have to declare it as abstract.
  2. Methods in interfaces are implicitly public.
  3. For extending an interface we have to use implements keyword.
  4. We can extend many interfaces using “implements” keyword however, we can only extend one class.

For your further understanding I have  also added a video .

Feel free to comment and subscribe.

Copyright ©TechOceanhub All Rights Reserved.