Categories: Keyword in Java

The implements keyword in Java language

The implements keyword in Java language

In this tutorial, we will discuss about The implements keyword in Java language

The   Java language  implements keyword is using to implement basic concrete of method definition in an interface. The implemented class must provide concrete implementation for the method definition by the interface if not the class must be abstract.

The following example explains how to implement a class using interface and provide details of implementation for the interface’s methods

Usage of implements keyword

Syntax

interface <interface_name>{
public void method1();            //method definition_1 No declaration inside interface
public void method2();           //method definition_1 No declaration inside interface
}

class <Class_name> implements <interface_name>
public void method1(){
//method 1 implementation
}
public void method2(){
//method2 implementation
}
}

Example

Interface School{
void beginning(); //unimplemented methods
void ending();
}
class student implements school{
void beginning(){
// beginning of the school}  //implements here
void ending(){
//Ending of the school
}
}

a class can implement multiple interface. the interface names are separated by commas

 

Example is given below

 

interface school{} //interface_one


interface teacher{} //interface_two


class student implements school,teacher{}

 

This is a single class implements by multiple interfaces

 

There are other Java language keywords that are similar to this keyword

extends keyword in java

public Key words in Java

static keyword in Java language

Volatile Keyword in Java

Transient keyword in Java

Package keyword in Java

class keyword in Java

boolean keyword in Java

break keyword in Java

do keyword in Java

double keyword in Java

This keyword in Java

final keyword in Java

switch keyword in Java

 

Suggested for you

 Java language Keywords

C language Keywords

 Python language Keywords

keywords in C language

Usage of final keyword in Java

Usage of this keyword in Java

 

 

 

 

The extends keyword in Java programming language
The interface keyword in Java language
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

PHP Star Triangle pattern program

PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…

6 months ago

PHP Full Pyramid pattern program

PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…

6 months ago

5 methods to add two numbers in Java

5 methods to add two numbers in Java In this tutorial, we will discuss the…

6 months ago

Python Full Pyramid star pattern program

Python full Pyramid star pattern program In this tutorial, we will discuss  the concept of…

9 months ago

Write a function or method to convert C into F -Entered by user

Write a function or method to convert C into F -Entered by the user In…

1 year ago

How to write a function or method to convert Celsius into Fahrenheit

How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…

1 year ago