Difference Between
versus

Extends keyword in Java vs. Implements keyword in Java: Know the Difference

Hifza Nasir
By Hifza Nasir & Dua Fatima || Published on May 28, 2026
The extends keyword in Java is used for class inheritance, allowing a class to inherit from another class, whereas implements is used by a class to adhere to an interface, defining methods the class must implement.
Extends keyword in Java vs. Implements keyword in Java

Key Differences

The extends keyword in Java signifies class inheritance, enabling a class to inherit properties and methods from a single superclass. This mechanism is foundational for achieving polymorphism and code reuse. Conversely, the implements keyword is utilized when a class agrees to implement an interface, a contract that mandates the implementation of all abstract methods defined within the interface. This approach promotes a form of polymorphism and flexibility, allowing a class to conform to multiple interfaces.
Hifza Nasir
Hifza Nasir
May 28, 2026
Extends facilitates the creation of a hierarchical relationship between classes, emphasizing the is-a relationship, implements focuses on the has-a capability, enabling a class to acquire certain functionalities defined by interfaces. This distinction highlights Java's support for single inheritance (via extends) and multiple implementations (via implements).
Dua Fatima
Dua Fatima
May 28, 2026
The use of extends is restricted to classes only, meaning a class can only extend another class. It cannot extend multiple classes due to Java's single inheritance principle. In contrast, implements allows a class to adhere to multiple interfaces, overcoming the limitation of single inheritance by enabling a class to exhibit multiple behaviors.
Hifza Nasir
Hifza Nasir
May 28, 2026
Extends is used when there is a clear hierarchical relationship needing property and method sharing. On the other hand, implements is chosen when a class must guarantee the implementation of certain behaviors, offering a way to enforce consistency across different classes without enforcing a strict parent-child class relationship.
Dua Fatima
Dua Fatima
May 28, 2026
The choice between extends and implements reflects design intent: extends is for extending functionality of existing classes, while implements is for agreeing to fulfill a contract of methods, enabling diverse classes to work interchangeably within the same framework or API.
Shumaila Saeed
Shumaila Saeed
May 28, 2026
ADVERTISEMENT

Comparison Chart

Usage

For class inheritance, allowing a class to inherit from another class.
For implementing interfaces, requiring a class to implement specified methods.
Dua Fatima
Dua Fatima
May 28, 2026

Inheritance Type

Single inheritance, can extend only one class.
Multiple inheritance, can implement multiple interfaces.
Hifza Nasir
Hifza Nasir
May 28, 2026

Relationship Type

Is-a relationship, indicating a specific type of hierarchy.
Has-a capability, indicating possession of certain functionalities.
Hifza Nasir
Hifza Nasir
May 28, 2026

Compatibility

Only between classes.
Between a class and one or more interfaces.
Shumaila Saeed
Shumaila Saeed
May 28, 2026

Functionality

Inherits all non-private members (methods and fields) from the parent class.
Must implement all abstract methods defined in the interface(s).
Dua Fatima
Dua Fatima
May 28, 2026
ADVERTISEMENT

Extends keyword in Java and Implements keyword in Java Definitions

Extends keyword in Java

Supports constructor chaining via super().
Super(parameters); in a subclass constructor.
Dua Fatima
Dua Fatima
Feb 26, 2024

Implements keyword in Java

Used by classes to agree to implement the methods of an interface.
Public class MyClass implements MyInterface {}.
Dua Fatima
Dua Fatima
Feb 26, 2024

Extends keyword in Java

Allows for polymorphic behavior through inheritance.
Animal myDog = new Dog();.
Hifza Nasir
Hifza Nasir
Feb 26, 2024

Implements keyword in Java

Requires concrete implementations of all abstract methods in the interface.
Public void myMethod() {} as defined in MyInterface.
Dua Fatima
Dua Fatima
Feb 26, 2024

Extends keyword in Java

Facilitates the use of super to access superclass methods and properties.
Super.methodName();.
Hifza Nasir
Hifza Nasir
Feb 26, 2024
ADVERTISEMENT

Implements keyword in Java

Enables a class to be more formally polymorphic.
MyInterface myClass = new MyClass();.
Hifza Nasir
Hifza Nasir
Feb 26, 2024

Extends keyword in Java

Used to inherit the properties and methods of one class into another.
Public class Dog extends Animal {} means Dog inherits from Animal.
Dua Fatima
Dua Fatima
Feb 26, 2024

Implements keyword in Java

Allows a class to adhere to multiple interfaces.
Public class MyClass implements Interface1, Interface2 {}.
Hifza Nasir
Hifza Nasir
Feb 26, 2024

Extends keyword in Java

Enables method overriding to provide specific implementations.
@Override in a subclass method.
Dua Fatima
Dua Fatima
Feb 26, 2024

Implements keyword in Java

Enforces method signatures consistency across different classes.
Consistent method implementations as per interface contract.
Hifza Nasir
Hifza Nasir
Feb 26, 2024

Repeatedly Asked Queries

Why can't Java classes extend multiple classes?

Java supports single inheritance to avoid complexity and ambiguity associated with multiple inheritances.
Hifza Nasir
Hifza Nasir
May 28, 2026

Can interfaces extend other interfaces?

Yes, interfaces can extend other interfaces, allowing for a hierarchy of interfaces.
Hifza Nasir
Hifza Nasir
May 28, 2026

Can a class use both extends and implements?

Yes, a class can extend another class and implement one or more interfaces simultaneously.
Hifza Nasir
Hifza Nasir
May 28, 2026

Can a class extend an interface?

No, a class cannot extend an interface; it can only implement interfaces.
Dua Fatima
Dua Fatima
May 28, 2026

Can interfaces contain implemented methods?

Yes, from Java 8 onwards, interfaces can contain default and static methods with implementations.
Shumaila Saeed
Shumaila Saeed
May 28, 2026

What is the extends keyword used for?

It's used for class inheritance in Java, allowing one class to inherit from another.
Dua Fatima
Dua Fatima
May 28, 2026

What does the implements keyword do?

It allows a class to implement an interface, requiring it to define the methods declared in the interface.
Hifza Nasir
Hifza Nasir
May 28, 2026

What is method overriding, and how does it relate to extends?

Method overriding is defining a method in a subclass that has the same signature as a method in its superclass, allowing the subclass to provide a specific implementation.
Hifza Nasir
Hifza Nasir
May 28, 2026

What happens if a class does not implement all methods of an interface?

The class must be declared abstract, or it will result in a compilation error.
Dua Fatima
Dua Fatima
May 28, 2026

Is it possible to implement multiple interfaces?

Yes, a class can implement multiple interfaces, making it versatile in its functionality.
Hifza Nasir
Hifza Nasir
May 28, 2026

What's the difference between extending a class and implementing an interface?

Extending a class inherits its properties and methods, while implementing an interface requires defining the methods declared in the interface.
Hifza Nasir
Hifza Nasir
May 28, 2026

How do extends and implements impact software design?

They encourage code reuse, polymorphism, and flexibility, enabling more modular and maintainable software design.
Hifza Nasir
Hifza Nasir
May 28, 2026

How does extends affect constructors?

Constructors are not inherited; however, a subclass can call a superclass constructor using super().
Dua Fatima
Dua Fatima
May 28, 2026

How do extends and implements contribute to polymorphism?

extends allows for polymorphic behavior through inheritance, while implements enables it by allowing classes to be interchangeable through common interfaces.
Dua Fatima
Dua Fatima
May 28, 2026

Can a class extend more than one interface?

The phrasing should be "implement more than one interface," and yes, it can.
Shumaila Saeed
Shumaila Saeed
May 28, 2026

Share this page

Link for your blog / website
HTML
Link to share via messenger
About Author
Hifza Nasir
Written by
Hifza Nasir
Dua Fatima
Co-written by
Dua Fatima

Popular Comparisons

Trending Comparisons

Virtual vs. DigitalVirtual vs. Digital
Shumaila SaeedShumaila Saeed
September 26, 2025
Virtual refers to something simulated by computer technology, while digital denotes data represented in binary form.
Smarter vs. More SmartSmarter vs. More Smart
Shumaila SaeedShumaila Saeed
September 25, 2025
"Smarter" is the comparative form of "smart," commonly used in English; "more smart" is a less standard comparative form used for emphasis or stylistic reasons.
Samoan vs. PolynesianSamoan vs. Polynesian
Shumaila SaeedShumaila Saeed
November 5, 2025
Samoan refers to the people, culture, and language of Samoa, a distinct nation within Polynesia, while Polynesian encompasses a broader group of cultures across the Pacific.
Central Standard Time vs. Eastern Standard TimeCentral Standard Time vs. Eastern Standard Time
Shumaila SaeedShumaila Saeed
June 12, 2026
Central Standard Time (CST) is one hour behind Eastern Standard Time (EST), with CST aligning with UTC-6 and EST with UTC-5 during standard time.
Contemporary Art vs. Traditional ArtContemporary Art vs. Traditional Art
Hifza NasirHifza Nasir
July 30, 2025
Contemporary art, made from the late 20th century on, focuses on modern themes and techniques. Traditional art, pre-dating this, follows historical and cultural norms.
RMS vs. PMPORMS vs. PMPO
Hifza NasirHifza Nasir
August 9, 2025
RMS (Root Mean Square) measures continuous power handling in audio equipment, indicating sound quality and clarity. PMPO (Peak Music Power Output) represents peak power, often exaggerated for marketing.
Company vs. FactoryCompany vs. Factory
Hifza NasirHifza Nasir
May 8, 2026
A company is a business entity engaged in commercial, industrial, or professional activities, while a factory focuses on manufacturing goods through mass production.
Saudi Arabia vs. UAESaudi Arabia vs. UAE
Dua FatimaDua Fatima
September 19, 2025
Saudi Arabia is largest country in the Middle East, known for its oil wealth and conservative Islamic culture, whereas UAE, federation of seven emirates, is renowned for its progressive cities like Dubai and Abu Dhabi, blending modernity with tradition.
Maguey vs. AgaveMaguey vs. Agave
Hifza NasirHifza Nasir
October 13, 2025
Maguey refers to specific Agave species used traditionally in Mexico for beverages and fibers, while Agave includes a broader genus of succulents, important in landscaping and tequila production.
Child vs. KidChild vs. Kid
Hifza NasirHifza Nasir
August 16, 2025
"Child" is a formal term referring to a young human being, often implying innocence and dependency, while "kid" is informal, suggesting familiarity and casualness.
Jewel vs. JewelryJewel vs. Jewelry
Shumaila SaeedShumaila Saeed
June 24, 2026
Jewel is a precious stone or gem. Jewelry are ornaments like rings, necklaces, made often with jewels.
Cliff vs. BluffCliff vs. Bluff
Hifza NasirHifza Nasir
November 1, 2025
A cliff is a steep, high rock face, often along coastlines or mountains, while a bluff is a broad, rounded cliff often overlooking a river, valley, or other flat areas, with a steep face and a relatively flat top.
Strive vs. ThriveStrive vs. Thrive
Shumaila SaeedShumaila Saeed
October 25, 2025
Strive involves making efforts towards a goal, while thrive denotes flourishing or prospering, often naturally.
Rite vs. RightRite vs. Right
Shumaila SaeedShumaila Saeed
June 10, 2026
Rite refers to a ceremonial act or procedure, while right denotes correctness, entitlement, or direction. Both terms play distinct roles in language and culture.
Villainize vs. VilifyVillainize vs. Vilify
Dua FatimaDua Fatima
October 8, 2025
Villainize involves portraying someone as a villain, emphasizing their negative traits. Vilify means to speak or write about in an abusively disparaging manner.
Firework vs. FirecrackerFirework vs. Firecracker
Hifza NasirHifza Nasir
August 26, 2025
Fireworks are large-scale pyrotechnics used for public displays, while firecrackers are smaller, noise-focused explosives for personal use.
Shiva vs. VishnuShiva vs. Vishnu
Shumaila SaeedShumaila Saeed
June 22, 2026
Shiva is a major Hindu deity symbolizing destruction and regeneration, while Vishnu represents preservation and the upkeep of the universe, both central figures in Hinduism with distinct roles in cosmic balance.
Falcon vs. EagleFalcon vs. Eagle
Shumaila SaeedShumaila Saeed
December 14, 2025
Falcons are smaller, faster birds known for their pointed wings and high-speed dives, while eagles are larger, possess broad wings, and showcase immense strength, especially in their talons.
Metro vs. TrainMetro vs. Train
Shumaila SaeedShumaila Saeed
October 11, 2025
Metro refers to an urban railway system for cities, typically underground; a train is a set of rail vehicles on railways, used for long or short distances.
Coach vs. TeacherCoach vs. Teacher
Hifza NasirHifza Nasir
November 11, 2025
A coach focuses on developing specific skills or achieving goals in sports or personal development, using hands-on methods. A teacher imparts academic knowledge, fostering understanding and critical thinking in a classroom setting.
Border vs. BoundaryBorder vs. Boundary
Hifza NasirHifza Nasir
December 11, 2025
A border is a line that marks the edges between countries, while a boundary delineates limits within countries, properties, or concepts.
Jazz Drum Kit vs. Rock Drum KitJazz Drum Kit vs. Rock Drum Kit
Shumaila SaeedShumaila Saeed
June 21, 2026
Jazz Drum Kits are typically smaller, with lighter tones for subtlety and nuance; Rock Drum Kits are larger and louder, designed for powerful, driving rhythms.
Closet vs. DresserCloset vs. Dresser
Shumaila SaeedShumaila Saeed
December 5, 2025
A closet is a tall, enclosed storage space usually built into a room's walls for hanging or storing clothes, while a dresser is a piece of furniture with drawers for keeping clothes and often has a flat top for items.
Rectangular vs. OblongRectangular vs. Oblong
Hifza NasirHifza Nasir
June 11, 2026
Rectangular shapes have four right angles; oblong shapes are elongated rectangles, often perceived as longer in one direction.

Featured Comparisons

New Comparisons