What is Extended Class Java?
In Java, an extended class (or subclass) is a class that inherits attributes and methods from another class (the superclass). This mechanism allows for code reuse and enhances the concept of polymorphism. A subclass can override methods from its superclass to provide specific implementations and can also introduce new methods and properties. The extends
keyword is used to define this relationship. For example:
class Animal { }
class Dog extends Animal { }
In this case, Dog
is the extended class that inherits from Animal
.