Abstraction in Java with Example Program
You must understand Polymorphism with example , before you get into details of abstraction. Abstraction means, skipping implementation details of behavior by expressing an entity in a generic way, leaving details to be defined by subclasses. In simple words, we define classes that contain only method prototypes but not the body of the methods, the methods' body is defined by subclasses. This approach help to process objects of subclasses polymorphically. In Java, abstraction is achieved using abstract classes and interfaces. In real life, when we plan something, first we think in terms of what needs to be done, then we go into details of how it should be done. In same way, in abstraction, we think, what behavior an entity should have and only declare that behavior (but not define it). Then, in each specific concept (or subclass), we define that behavior i.e. 'how' a specific class should act. For example, consider a student in academic system, identify common beha...