GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Java Tutorial
  • Advanced Java
  • Interview Questions
  • Exercises
  • Examples
  • Quizzes
  • Projects
  • Cheatsheet
  • DSA in Java
  • Java Collection
  • wrappers
  • exceptions
  • StringBuilder
  • StringBuffer

This view

  • Original page
  • New address

GeezerVison is showing www.geeksforgeeks.org — Java.lang package in Java - GeeksforGeeks

geeksforgeeks
search icon
  • Courses
  • Tutorials
  • Interview Prep
  • Java Tutorial
  • Advanced Java
  • Interview Questions
  • Exercises
  • Examples
  • Quizzes
  • Projects
  • Cheatsheet
  • DSA in Java
  • Java Collection

Java.lang package in Java

Last Updated : 24 Jun, 2026

The java.lang package is one of the most fundamental packages in Java. This package provides essential functionality such as object manipulation, string handling, mathematical operations, exception handling, threading, and system-level operations.

  • Automatically imported by the Java compiler.
  • Contains core classes required by every Java program.
  • Provides support for strings, wrappers, threads, exceptions, and system operations.

Why is the java.lang Package Important?

  • It is automatically available in every Java program.
  • It contains the most commonly used classes in Java.
  • It provides the Object class, which is the parent of all Java classes.
  • It offers classes for working with strings, such as String and StringBuilder.
  • It provides mathematical functions through the Math class.
  • It supports exception handling using classes like Exception and Throwable.

Common Classes in java.lang

ClassDescription
ObjectRoot superclass of all Java classes.
StringRepresents an immutable sequence of characters.
StringBuilderMutable sequence of characters for efficient string manipulation.
StringBufferThread-safe mutable sequence of characters.
SystemProvides access to system resources, standard input/output, and environment variables.
MathContains methods for performing mathematical operations.
ThreadRepresents a thread of execution in a Java program.
RunnableInterface used to define tasks executed by threads.
ExceptionBase class for exceptions that can be handled by applications.
ErrorRepresents serious system-level errors that applications typically do not handle.
ThrowableSuperclass of both Exception and Error.
RuntimeProvides access to the Java runtime environment.
ProcessRepresents a process running in the operating system.
ClassRepresents metadata about classes and interfaces at runtime.
IntegerWrapper class for the primitive int type.
LongWrapper class for the primitive long type.
DoubleWrapper class for the primitive double type.
FloatWrapper class for the primitive float type.
CharacterWrapper class for the primitive char type.
BooleanWrapper class for the primitive boolean type.
ByteWrapper class for the primitive byte type.
ShortWrapper class for the primitive short type.
VoidRepresents the void return type.
EnumBase class for all Java enumerations.
PackageContains information about Java packages.

Advantages of java.lang Package

  • Automatically Imported: No need to explicitly import the package in Java programs.
  • Provides Core Java Classes: Contains fundamental classes required for almost every Java application.
  • Supports Object-Oriented Programming: Includes the Object class, the root of the Java class hierarchy.
  • Simplifies String Handling: Offers classes like String, StringBuilder, and StringBuffer.
  • Built-in Mathematical Functions: The Math class provides common mathematical operations.
  • Exception Handling Support: Contains classes for handling exceptions and errors.
  • Multithreading Capabilities: Provides the Thread and Runnable classes.
  • Wrapper Class Support: Includes wrapper classes such as Integer, Double, and Boolean.
  • System-Level Operations: The System and Runtime classes allow interaction with the JVM and operating system.

Relatable articles

  • Flexible nature of java.lang.Object
  • Java.lang.system arraycopy method
  • Equals() and hashCode() methods in Java
  • Why to Override equals(Object) and hashCode() method ?
Comment

Explore

    Basics
    • Introduction3 min read
    • Variables2 min read
    • Data Types7 min read
    • Operators7 min read
    • Decision Making5 min read
    • Methods7 min read
    • Arrays7 min read
    • Strings5 min read
    OOP & Interface
    • Introduction6 min read
    • Constructors6 min read
    • Encapsulation3 min read
    • Inheritance8 min read
    • Polymorphism5 min read
    • Abstraction5 min read
    • Interfaces8 min read
    Collections
    • Collection class9 min read
    • Collection Interface5 min read
    • List Interface8 min read
    • Set Interface5 min read
    • Queue Interface5 min read
    • Map Interface in Java6 min read
    • Iterator4 min read
    Advance Java Concepts
    • Exception handling6 min read
    • Java Multithreading Tutorial3 min read
    • Synchronization in Java9 min read
    • File handling6 min read
    • Method References3 min read
    • Java 8 Stream Tutorial7 min read
    • Memory Management4 min read
    • Garbage Collection in Java6 min read
    • Networking6 min read
    • JDBC5 min read
    Practice Java
    • Interview Questions15+ min read
    • Programs6 min read
    • Practice Problems5 min read
    • Quiz1 min read
    • Project Ideas15+ min read
    Courses
    • Java Backend Course2 min read
    • Placement 360 Course2 min read
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.