Computer Science, asked by Hetansh2005, 5 months ago

what is the need of inheritance in java​

Answers

Answered by shivaramcvm
1

Inheritance is a process of defining a new class based on an existing class by extending its common data members and methods. Inheritance allows us to reuse of code, it improves reusability in your java application.

pls mark as brainlist

Answered by studiousgirl42
2

Answer:

In Java, we use the extends keyword to inherit from a class. Here, we have inherited the Dog class from the Animal class. The Animal is the superclass (parent class or base class), and the Dog is a subclass (child class or derived class). The subclass inherits the fields and methods of the superclass.

Similar questions
Sociology, 2 months ago