Package java.lang
The java.lang package in Java is a core package that includes the fundamental classes and features of Java language. It is automatically available in every Java program eliminating the need for explicit import statements.
Example of java.lang package:
Java
//Java program to demonstrate 'java.lang' package import java.io.*; import java.lang.*; class GFG { public static void main(String args[]) { String s1 = "Hello" ; String s2 = "Geeks" ; String result = s1+ " " +s2; System.out.println(result); } } |
Output
Hello Geeks
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.