answersLogoWhite

0


Best Answer

Packages are containers-for-classes used to keep the class namespace compartmentalized.

Using Package,

1. We can define classes inside a package that are notaccessible by the code outside that package.

2. We can define class members that are only accessible by code inside that package.

3. We can have a class stored in a package withoutconcern that it will collide with some other class (havin same name), stored else where.

Package is basically a collection of predefined or ready-made classes that can be used in your java program to make shorter as well as easier. Package- import java.lang.*; is always implicitly called when you write a java program.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

packages are collection of similar classes grouped together.

This is a way to organize files when a project consists of multiple modules. It also helps resolve naming conflicts when different packages have classes with the same names. Packages access level also allows you to protect data from being used by the non-authorized classes.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

This is a way to organize files when a project consists of multiple modules. It also helps resolve naming conflicts when different packages have classes with the same names. Packages access level also allows you to protect data from being used by the non-authorized classes.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

A package is a grouping of related types providing access protection and name space management. Here the term types may refer to classes, interfaces, enumerations, and annotation types. You can enclose all these into a package for easier identification.

For ex: the java.io package provides us with all java classes that can be used for input output operations.

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

A package is mechanism that provides additional grouping. They are intended to group similar classes together and to limit scope to avoid classes with the same name.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the need of package in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Supermost package of java?

The supermost package of Java is the "java" package.


What is the library in java which does not need to be imported?

The java.lang package in Java is automatically imported for you.


What is a collection of related classes called in java?

a package


What are the feature's of the Java 'this' installation package?

The Java 'this' installation package allows one to create installation programs for their Java based applications. One can download the program from Java.


Do I need Java?

No, if a program needs Java it'll specify that it does in the installer package for the program or on the website for the program or a section usually called "Requirements" for a specific program.


What is a default package in Java?

A default package is a package with no name. You can create a Java class without putting package name on top of the code. This class is included in the "default package". Be careful not to be confused with java.lang, which is a package that contains Java's fundamental classes and get's imported by default.


Which package is inbuilt in java API?

The java.lang package is automatically imported for you.


What is user define package?

A user defined package is a package outside of the standard Java libraries.


Import a package second time in Java?

You can import a package as many times as you want in Java. The compiler will just ignore any duplicates.


Is it possible to draw in java without using applet?

Yes it is possible to draw in java by using AWT package. or by using javax package.


Why you use user defined package in java?

Because, we dont have the package which we want perform the specific task in the lib. Thatz why we need to create packages own and importing it.


How do you complie package in java?

You use javac <filename> to compile a class or package.