Abstraction


As per dictionary, abstraction is the quality of dealing with ideas rather than events. Consider a real-life example of a man driving a car. The man only knows that pressing the accelerators will increase the speed of car, but he does not know about how on pressing the accelerator the speed is actually increasing, he does not know about the inner mechanism of the car or the implementation of accelerator in the car. This is what abstraction is.

Abstract Classes and Methods
In OOP, abstraction is a process of hiding the implementation details from the user, and only the functionality will be provided to the user. In Java, abstraction is achieved by using abstract classes and interfaces. Why Abstraction?
There are situations in which we will want to define a superclass that declares the structure of a given abstraction without providing a complete implementation of every method. That is, sometimes we will want to create a superclass that only defines a generalization form that will be shared by all of its subclasses, leaving it to each subclass to fill in the details.

Review: Abstraction Definition
    Which statement is NOT true about abstract classes?

      All methods in an abstract class must be abstract methods (no concrete methods allowed).
      An abstract method is a method that is declared without an implementation.
      Any class that contains one or more abstract methods must also be declared with abstract keyword.
      There can be no object of an abstract class.
        Result: