
Abstraction in Java or Object oriented programming is a way to segregate implementation from interface and one of the five fundamentals along with
Encapsulation,
Inheritance,
Polymorphism,
Class and
Object. Abstraction in Java is achieved by using interface and
abstract class in Java. An interface or abstract class is
something which is not
concrete , something which is
incomplete. In order to use interface or abstract class we need to extend and implement abstract method with concrete behavior. One example of Abstraction is creating interface to denote common behavior without specifying any details about how that behavior works e.g. You create an
interface called
Server which has
start() and
stop() method. This is called abstraction of Server because every server should have way
to start and stop and details may differ. As I said earlier Abstraction in Java is implemented using abstract class and interface as discussed in next
section. In fact What is abstraction in Java, Difference between Abstraction and Encapsulation is also a very
popular core Java interview because strong OOPS skill is one of the primary requirement for Java developers.