answersLogoWhite

0


Best Answer

Inheritance is a means where a class borrows ("inherits") functionality from a base class, usually as a means of code reuse; the subclass will often add additional functionality or modify the behavior of the base class. Packages are simply a way of organizing code into namespaces, such that: Only classes that are actually part of the application logic are included, to prevent conflicts from classes that have the same name, and to logically organize code so that similar functionality can be grouped together.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between inheritance and packages?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Difference between composition and inheritance?

The 'is a' relationship is expressed with inheritance and 'has a' relationship is expressed with composition. Both inheritance and composition allow you to place sub-objects inside your new class. Two of the main techniques for code reuse are class inheritance and object composition. Inheritance [ is a ] Vs Composition [ has a ] Building Bathroom House class Building{ ....... } class House extends Building{ ......... } is a [House is a Building] class House { Bathroom room = new Bathroom() ; .... public void getTotMirrors(){ room.getNoMirrors(); .... } } is a has a [House has a Bathroom] has a Inheritance is uni-directional. For example House is a Building. But Building is not a House. Inheritance uses extends key word. Composition: is used when House has a Bathroom. It is incorrect to say House is a Java - Fundamentals 19 Bathroom. Composition simply means using instance variables that refer to other objects. The class House will have an instance variable, which refers to a Bathroom object.


Does hybrid inheritance consist of ANY two types of inheritance?

There are only two types of inheritance to begin with: single inheritance and multiple inheritance. Since they are mutually exclusive there is no such thing as hybrid inheritance.


Why we use io packages in multilevel inheritance?

Multilevel InheritanceA Scenario where one class is inheriting/extending the bahavior of another class which in turn is inheriting behavior from yet another class.Ex: public class Automobile {…}Public class Car extends Automobile {…}Public class Ferrari extends Car {…}This multilevel inheritance actually has no limitations on the number of levels it can go. So as far as java goes, it is limitless. But for maintenance and ease of use sakes it is better to keep the inheritance levels to a single digit number.A point to note here is that - using io packages is not mandatory. You need to use them only if you want to have some i/o operations in your code.


What is the difference between technology and process?

what is the difference between license and patent


What is the difference between an assembler and a translator?

what is the difference between an assembler and the translator

Related questions

What is the difference between vertical and horizontal systems packages?

explain the difference berween vertical and horizontal system packages?


What is the difference between .RPM and .deb packages?

Check out the related links for information on the differences between .rpm and .deb packages.


Is there a difference between estate being willed to you or inheritance?

No. Property that you receive by a will IS an inheritance. Property received from a relative under the laws of intestacy when there was no will is also an inheritance.


What is the difference between sex-linked and maternal inheritance?

they have different meanings


What is the difference between pleiotropy and polygenic inheritance?

tatti kha meri kutey


What is the difference between cytosplasmic and mendelian inheritance?

To make this simple cytoplasmic inheritance is the inheritance of genes in organelles such as mitochondria that do not go through regular mitosis which is Mendelian inheritance. It is a bit more complex than this and can be easily Googled.


What is the home insurance cost difference between companies?

Two different companies may offer different home insurance packages for their employees. The difference between such packages is determined by the revenue of the company in question and the value of the employee for the company.


What is the difference between death tax and estate tax?

Inheritance taxes and estate taxes differ only in who pays and to whom the tax is paid. Learn the differences between inheritance and estate taxes.


What is the difference between inheritance and earnings?

Inheritance is what you get if someone who dies has decided that you should have some of his/her belongings. Earnings are typically your salary, the pay you get for having done some work.


What is difference between bank and post office?

A bank handles money and a post office handles letters and packages.


Difference between program and package?

There are fundamental similarities and difference between computational programming and packages. A computer program are the set of instructions behind a specific application or software. A package is set of software programs.


whats the difference between direct tv and dish tv?

There really is no difference between the two companies other than the price. Both offer the same basic packages, and the same service coverage areas.