Java - Abstraction
Categories: Java 8(JDK1.8)
Abstraction is the quality of dealing with ideas rather than events. For example, when you consider the case of e-mail, complex details such as what happens as soon as you send an e-mail, the protocol your e-mail server uses are hidden from the user. Therefore, to send an e-mail you just need to type the content, mention the address of the receiver, and click send.
Likewise in Object-oriented programming, abstraction is a process of hiding the implementation details from the user, only the functionality will be provided to the user. In other words, the user will have the information on what the object does instead of how it does it.
Abstract Class
1. A class which contains the abstract keyword in its declaration is known as abstract class.
2. Abstract classes may or may not contain abstract methods, i.e., methods without body ( public void get(); ) But, if a class has at least one abstract method, then the class must be declared abstract.
3. If a class is declared abstract, it cannot be instantiated.
4. To use an abstract class, you have to inherit it from another class, provide implementations to the abstract methods in it.
5. If you inherit an abstract class, you have to provide implementations to all the abstract methods in it.