Difference between java.lang and java.util
Characteristics |
java.lang |
java.util |
---|---|---|
Purpose |
The Core package of the Java language that provides fundamental classes and features |
Utility package that provides useful classes and features for the more advanced programming tasks |
Classes |
To Provides fundamental classes such as String, Integer and Object |
Provides utility classes such as ArrayList, HashMap and Scanner |
Auto-Import |
The Classes are automatically imported in the every Java program |
The Classes need to be explicitly imported in Java programs |
Usage |
Used for the basic programming tasks such as string manipulation and object manipulation |
Used for the more advanced programming tasks such as data structures and date/time manipulation |
Difference Between java.lang and java.util
Java Packages contain classes, interfaces, and sub-packages. The packages java.lang and java.util are two of the most commonly used packages in Java Standard Library. Both packages contain useful classes and utilities.
In this article, we will learn about java.lang and java.util package with examples and also the difference between these two packages.