answersLogoWhite

0

Inheritance in Java refers to the feature wherein the code/functionality of one class can be used in another class that extends this class. Example:

public class Parent {

...

..

}

public class Child extends Parent {

...

..

.

}

Here the class Child extends the class Parent and hence the methods of Parent are available for Child to use. This way we are re-using the code in the parent class in the child class instead of re-writing the whole thing again.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What is advantage of software reusability?

What is advantage of software reusability?


What is a use inheritance?

Code Re-use is one of the biggest uses of Inheritance


How the three tired architecture provides reusability?

I don't believe so. If they are tired, no use at all, let along re-use.


Why do we use sunclasses?

Subclasses allow for code reusability and inheritance in object-oriented programming. They enable the creation of more specific classes that inherit attributes and methods from a parent class. This helps in organizing and managing code, as well as promoting modularity and flexibility in the design of software systems.


Specialization form of inheritance?

Inheritance refers to the concept by which the features from one class can be extended/made available in other classes. Java supports 3 forms of inheritance * Single Inheritance * Multiple Inheritance * Multilevel Inheritance (Can be implemented using interfaces)


How do OO analysis and design facilitate reusability?

Through the use of interfaces and abstract classes that define common behaviors


Use the word inheritance in a sentence?

She received a large inheritance from her wealthy grandmother.


Features of Autocad?

Reusability,error tracking etc


Which two methods were first introduced to slow decay?

The two methods first introduced to slow decay are encapsulation and inheritance. Encapsulation allows data hiding to restrict access to certain components of an object, while inheritance enables the creation of new classes by inheriting attributes and methods from existing classes. These techniques help in organizing code, improving reusability, and reducing code duplication.


What is re usability in c plus plus?

Code reusability can be found in every programming language, it is not a feature that is specific to C++. However, object oriented languages such as C++ give us much better opportunities for code reusability through inheritance. That is, a derived class inherits the public and protected members of its base classes, so we can make use of existing code to provide more specialised implementations. We don't have to continually re-invent wheels to implement base class functionality that already exists. Moreover, shared class libraries allow us to re-use code in more than one application.


What supports reusability and extensibility of classes in c plus plus?

There are two ways to reuse a class in C++. Composition and inheritance. With composition, any class data member can be an instance of an existing class. With inheritance, we can derive a new class from an existing class. Either way, we create a new class of object with all the properties of the existing class which can be extended and/or replaced with properties of our own.


Why is resusability important?

Reusability is important because it helps in reducing waste, conserving resources, and minimizing environmental impact. By reusing items or materials instead of disposing of them after one use, we can contribute to a more sustainable and efficient way of living. Additionally, reusability can also lead to cost savings in the long run.