

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Types of packages in Java
Packages are used in Java in order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations easier, etc.
A Package can be defined as a grouping of related types (classes, interfaces, enumerations, and annotations ) providing access protection and namespace management.
Some of the existing packages in Java are −
- java.lang − bundles the fundamental classes
- java.io − classes for input, output functions are bundled in this package
Programmers can define their own packages to bundle a group of classes/interfaces, etc. It is a good practice to group related classes implemented by you so that a programmer can easily determine that the classes, interfaces, enumerations, and annotations are related.
Since the package creates a new namespace there won't be any name conflicts with names in other packages. Using packages, it is easier to provide access control and it is also easier to locate the related classes.
- Related Questions & Answers
- Packages in Java
- Advantages of using packages in Java
- Explain packages in Java
- What are packages in Java?
- Creating and using packages in Java
- How to compile packages in Java
- Overview of Packages in Oracle
- Explain naming conventions for packages in java?
- Which packages contain Wrapper class in Java?
- Difference Between Packages and Interfaces in Java
- Types of variable in java
- Types of inheritance in Java
- Types of Array in Java
- Types of References in Java
- Types of Java comments.