Java – Interface Introduction

Home/Java - Tutorial/Java - Interfaces/Java – Interface Introduction
Java – Interface Introduction 2017-06-03T12:56:23+00:00

Java Interface:

Interfaces are similar to abstract classes, but differ in their functionality.

In interfaces, none of the methods are implemented means interfaces defines methods without body.

Interfaces are syntactically similar to classes, but they lack instance variables, and their methods are declared without any body.

But, it can contain final variables, which must be initialized with values.

Once it is defined, any number of classes can implement an interface.

One class can implement any number of interfaces.

If we are implementing an interface in a class we must implement all the methods defined in the interface as well as a class can also implement its own methods.

Interfaces add most of the functionality that is required for many applications which would normally resort to using multiple inheritance in C++.

Prev Next