Java, OOP

Abstraction in Java

uzairadamjee / February 13, 2018

Abstraction is to hide the unnecessary details from the user and to show only relevant things/data to the user.

Abstract class: Abstract class in Java contains the abstract keyword. If a class is declared abstract, it cannot be instantiated, means that you cannot create an object of an abstract class. Also, an abstract class can contain abstract as well as concrete methods. This abstract class needs to be inherited/

 

Example of Abstract class: abstract class Student{}

Example of Abstract method: abstract void printName()

Leave a Reply

Your email address will not be published.