What are the Benefits of Organizing Classes in to Packages

1. The classes contained in the packages of other programs can be easily reused.

2. In packages, classes can be unique compared with classes in other packages. That is, two classes in two different packages can have the same name.

3. Packages provide a way to “hide” classes thus preventing other programs or packages from accessing classes that are meant for internal use only.

4. Packages also provide a way for separating “design” from “coding”.

Related

Finalizer Method in Java

FINALIZER METHODS: We have seen that a constructor method is used to initialize an object when it is declared. This process is known as initialization. similarly,java supports a concept called fi...

How to Hide Class in a Package?

Hiding classes: When we import a package using astric(*),all public classes are imported.however ,we may preffer to “not import”certain classes.i.e,we may like to hide these classes from accessing ...

How to add a new Class to a Package?

Adding a class to a package: It is simple to add a class to an existing  package.consider the following package. package p1; public classA { Body of A } The package p1 contains one p...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item