Java is a programming language that supports several methods and functions that are utilized to develop different applications. The basic parameters while coding in Java involve importing the packages, declaring the classes, and implementing the methods, properties, or functions as per the program requirements. Among all the basics, the foremost step is to declare the class in Java. The interfaces can also be used instead of classes in Java implementing different functionalities.
The content of this article will be organized in the following manner:
- What is Interface in Java?
- How to Use the Implements Keyword?
- Implements keyword on class in Java
- Implements keyword on multiple interfaces
- Extend vs Implement Keyword
- Conclusion
What is an Interface in Java?
First, let’s comprehend what exactly abstraction is in Java. The term abstraction refers to a property through which only important details are displayed to the user. Now the term “interface” will be easy to comprehend.
Interface in Java is used to describe the abstract type that defines the behavior of the class. It is a useful way to achieve multiple inheritances in Java since multiple inheritance can not be implemented through classes in Java.
How to Use the Implements Keyword?
The implements keyword in Java is utilized when there is a need to use the interface in the class. In order to have access to the interface’s method there is a need to use the implements keyword with the class declaration.
Implements keyword in Java
The code below shows how the interfaces are used along with the “implement” keyword with classes in Java.
// interface declared
interface Student {
public void name();
public void marks();
}
class Position implements Student {
//Print the name
public void name() {
System.out.println("My name is John");
}
//Print the marks
public void marks() {
System.out.println("The marks are: 89" );
}
}
class JavaClass {
public static void main(String[] args) {
Position myPosition = new Position();
myPosition.name();
myPosition.marks();
}
}
In the above code block:
- The interface is declared as “Student” and two objects are declared as “name” and “marks”.
- The class declared as “Position” implements the “Student” class.
- The name of the student is printed using the name() method declared in the interface.
- The marks are also printed using the marks() method declared in the interface.
- In the last part of the code, a new object is created for the class and the interface methods are accessed using the class object.
Output
The output below shows that by using the name() and marks() functions the results are printed on the screen.

Implements keyword on Multiple Interfaces in Java
The implement keyword can be implemented on multiple interfaces in Java. The code below shows the implementation of the “implements” keyword using two interfaces.
// interface declared
interface PositiveNumbers {
public void p_num();
}
interface NegativeNumbers {
public void n_num();
}
class Numbers implements PositiveNumbers, NegativeNumbers {
//Print the positive numbers
public void p_num() {
System.out.println(" '5' is a Positive Number");
}
//Print the negative numbers
public void n_num() {
System.out.println("-12 is a negative Number" );
}
}
//main() method of Java
class JavaClass {
public static void main(String[] args) {
Numbers mynum = new Numbers();
mynum.p_num();
mynum.n_num();
}
}
In the above code block:
- The first interface is declared as “PositiveNumbers”.
- The second interface is declared as “NegativeNumbers”.
- The class “Numbers” implements both the interfaces.
- The output for both interfaces is printed using the objects declared in the main() method of Java.
Output
The output below shows that the results are printed according to the input provided.

Bonus Tip: Extends vs. Implements Keyword
Extends and implements both are keywords in Java that can be implemented according to the program’s requirement. There are some differences between the two keywords as stated below:
- By implementing the “extends” keyword a class can inherit another class or an interface can inherit another interface. Whereas using the “implements” keyword a class can implement the interface.
- The subclass doesn’t necessarily override all the methods/functions of the superclass utilizing the extends keyword. On the other hand, the class that is implementing the interface must utilize all the functions/methods of the interface.
- Only one superclass at a time can be extended to the subclass. Whereas multiple interfaces can implement the class.
This winds up the use of the implement keyword in Java.
Conclusion
The implements keyword in Java is utilized when there is a need to use the interface in the class. The implements keyword is useful since it utilizes the interfaces in Java through which the mechanism of multiple interfaces is achieved which can not be done through classes. In this article, we have implemented the “implements” keyword in Java.