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.

Similar Reads

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....

Package java.util

...

Difference between java.lang and java.util

The java.util package in Java is a versatile utility package encompassing numerous classes and interfaces designed for the various advanced programming tasks and it offers a broad range of the functionalities including data structures, input/output operations and many other commonly used utilities....