Menu
gps garage
  • Home
  • Health
  • Nature
  • IT & Software
  • Science
  • Technology
  • Offers
  • Write for Us
    • Privacy Policy
    • Terms & Conditions
gps garage
Interface and abstract class in Java

Want to know concept of Interface and abstract class in Java?

Posted on May 1, 2021May 4, 2021

Interface and abstract class in Java

Interface in Java

Java does not support the multiple inheritance so, to overcome with this java gives concept of interface. Interface is a template that has only declaration of methods. It means when a class implement the interface then method implementation is done in that class.

interface

For example, consider the following code-

Public abstract interface Calculation //interface declaration

{

public abstract void addition(); //method declaration

public abstract void division();

}

Note-Internally all the methods of interface are public abstract void and variables are public static final.

 

Abstract Class in Java

Abstract classes cannot create objects. So to access the methods of abstract class you need to inherited by that abstract class. Abstracted classes have both abstract as well as non-abstract methods. To create a abstract class you need to use ‘abstract’ keyword on before the class keyword.

Interface and abstract class in Java

For example, consider the following code-

public abstract class Calculation{

public abstract void addition(); //abstract method declaration

public void multiply(){}

}

 

Download JDK

Download JRE

Must Read – JIT Compiler

Categories

  • Education
  • Entertainment
  • Features
  • Game
  • Health
  • IT & Software
  • Must Read
  • Nature
  • News
  • Offers
  • Popular News
  • Science
  • Technology
  • Trending News
  • World

Archives

  • March 2025
  • January 2025
  • December 2024
  • September 2022
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021

Categories

  • Education
  • Entertainment
  • Features
  • Game
  • Health
  • IT & Software
  • Must Read
  • Nature
  • News
  • Offers
  • Popular News
  • Science
  • Technology
  • Trending News
  • World

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2025 GPS Garage | Powered by SuperbThemes