Tuesday 17 November 2015

What is Abstraction ? Give a realtime example of abstraction

Abstraction is process of hiding the implementation details and showing only the functionality. It is achieved by using interface and abstract class.

There are two ways to achieve abstraction in java :

1. Abstract class (0 to 100%): A class that is declared as abstract is known as abstract class


2. Interface (100%): 100% abstract class is known is an Interface


Note: We cannot create instance of abstract class , its compiler error.
Example:


 

No comments:

Post a Comment