What is Abstraction in java - OOPS principles

Abstraction
In short, Abstraction means hiding the implementation.
Abstraction means representing only the essential things without including background details.
In java abstraction can be achieved by using >


Interface
Abstract class
Interface helps in achieving pure abstraction in java.
Abstract class aren’t purely abstraction in java
All Interface are abstract by default.
So, it’s not mandatory to write abstract keyword with interface.

Example-
interface MyInterface {//compiler will add  abstract
}

Because of default additions done by compiler, above code will be same as writing below code-

abstract interface MyInterface {
}

It’s mandatory to write abstract keyword to make class abstract.


Example-

abstract class MyAbstractClass{
  
   abstract void m();
  
}

Must read : 10 Differences between Interface and abstract class in java - in detail with programs





RELATED LINKS>

Java tutorial & history of java >

Java tutorial - Advantage, Where is java used in real world, platform independent language



Classes, objects, interface, abstract classes and constructors >

Classes and Objects in java - Class consist of blocks, constructor, variables, methods, inner classes and inner interfaces



Interface in java - Multiple inheritance, Marker interfaces, When to use interface practically, 12 features



Abstract class in java - When to use abstract class or interface practically, 10 features



Access modifiers >

Access modifier /Access specifier in java - private, package-private(Default), protected and public - Diagram and tabular form


Method overloading and overriding >

Method overloading in java - in detail with programs,10 Features,need of method overloading, overloading main method, Diagram and tabular form of Implicit casting/promotion of primitive Data type


Method overriding in java - in detail with programs, 10 Features, need of method overriding, understanding @Override annotation, Covariant return, diagram to understand access modifiers

eEdit
Must read for you :