Types of Java Packages
Types of Java Packages
In this tutorial, let’s learn about the types of Java packages. Java packages can be broadly classified into two types:
- Built-in Java API Packages
- User-defined Packages
Built-in Java Packages
Java API provides classes grouped into different standard built-in packages. These packages are also called pre-defined packages. These are built-in packages developed by Sum Microsystems/Oracle Corporation to deal with the universal requirements of different types of Java applications. The built-in packages are part of JDK.
The core packages that belong to J2SE start with java.<package_name>. The advanced packages that belong to J2EE start with javax.<package_name>
Some of the built-in core packages are:
- java.lang
- java.util
- java.io
- java.net
- java.sql
java.lang: The primary and fundamental classes and interfaces. This package defines the language functionalities and basic services. This package is by default imported to every Java program. There is no need to import these classes explicitly.
User-Defined Packages
User-defined packages are defined and created by Java application programmers. These packages are also known as programmer-defined packages. Packages that are developed by third-party vendors are called third-party packages. We create user-defined packages for our own purpose. Also, we need to import the classes in third-party user-defined packages to make use of them.
—
Java Tutorials
Java Tutorial on this website:
https://www.testingdocs.com/java-tutorial/