

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between extends and implements keywords in Java
In this post, we will understand the differences between ‘Extends’ and ‘Implements’ keyword.
Extends
Using this, a class can be used as a base class, and another class inherits this base class.
An interface can also inherit other interfaces using this keyword.
Only one superclass can be extended by a class.
Any number of interfaces can be extended by an interface.
It is not required for the subclass (that extends a superclass) to override all the methods in the superclass.
Following is an example of the extends keyword −
Example
class Super { ..... ..... } class Sub extends Super { ..... ..... }
Implements
This keyword helps a class to implement an interface.
A class can implement any number of interfaces at a point in time.
It is required for a class (that implements an interface) to implement all the methods of that specific interface.
It can never be used implement any other interface.
Following is an example of the implements keyword
Example
public interface Animal { } public class Mammal implements Animal { } public class Dog extends Mammal { }
- Related Questions & Answers
- What is the difference between super and this, keywords in Java?
- What is the difference between keywords and reserved words in Java?
- What is the difference between throw and throws keywords in Java?
- Explain the difference between const and readonly keywords in C#
- What is the difference between keywords const and readonly in C#?
- What is the difference between VAR and DYNAMIC keywords in C#?
- The extends Keyword in Java
- What is the difference between public, static and void keywords in C#?
- Keywords in Java
- Can Enum implements an interface in Java?
- Are true and false keywords in java?
- Difference between Java and JavaScript.
- Difference between Go and Java.
- Difference Between C++ and Java
- Difference between Java and C language