.

Java Tutorial: Abstraction in Java

What is Abstraction?

  • It is a concept of projecting important ideas
  • What is basically needed to perform something is highlighted in abstraction
  • It conceals the internal workings and projects its main functionality to the end user
  • It is employed through the concepts called Abstract Classes and Interfaces

Abstract Class

  • It is a classNamewhich holds an abstract keyword in front of the classNamename
  • This classNamecontains abstract methods
  • An abstract classNameneed not to be initialised
  • A classNamewith abstract method is to be introduced with abstract class
  • Always this classNameis to be inherited
  • The abstract methods are to be employed in case of inheriting this class
  • The method has only the method prototype not the definition in its abstract class

Syntax

public abstract classNamebas_class
{
abstract void shw();
}
public classNamederivd_class
{
abstract void shw()
{
}
}

Example

abstraction img1
.