0% found this document useful (0 votes)
11 views8 pages

Java Lang Package

The java.lang package is a core component of the Java programming language, automatically imported in every Java program. It includes essential classes for object handling, strings, mathematical operations, system utilities, multithreading, exception handling, and wrapper classes for primitive data types. Key classes within this package include Object, String, System, Math, Thread, and various exception handling classes.

Uploaded by

jose2985
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

Java Lang Package

The java.lang package is a core component of the Java programming language, automatically imported in every Java program. It includes essential classes for object handling, strings, mathematical operations, system utilities, multithreading, exception handling, and wrapper classes for primitive data types. Key classes within this package include Object, String, System, Math, Thread, and various exception handling classes.

Uploaded by

jose2985
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Language Package in Java

(java.lang)
Core classes, usage, and examples
Introduction to java.lang Package
• • java.lang is the core language package in
Java.
• • It contains classes fundamental to the Java
programming language.
• • Automatically imported in every Java
program.
• • Provides support for basic data types,
strings, math functions, system utilities,
exceptions, and threads.
Important Classes in java.lang
• • Object – Base class for all Java classes.
• • String – Represents text.
• • System – Provides access to system-level
resources.
• • Math – Contains mathematical operations.
• • Thread – Used for multithreading.
• • Exception, Error, Throwable – For error and
exception handling.
• • Wrapper classes – Integer, Double, Boolean,
Wrapper Classes
• • Used to represent primitive data types as
objects.
• • Useful in collections and for object-oriented
features.

• Examples:
• Integer, Double, Character, Float, Boolean,
Byte, Short, Long.
Math and System Classes
• Math Class:
• • Contains static methods for common
mathematical operations.
• • Examples: sqrt(), pow(), abs(), sin(), cos(),
random().

• System Class:
• • Provides system-level operations like I/O and
environment access.
Thread and Runnable Classes
• • Thread: Used to create and manage threads.
• • Runnable: Interface for defining thread
tasks.

• Example:
• class MyThread extends Thread {
• public void run() {
• System.out.println('Thread is running...');
• }
Exception Handling in java.lang
• • Throwable – Base class for all errors and
exceptions.
• • Exception – Recoverable conditions in a
program.
• • Error – Serious problems that applications
should not try to handle.

• Example:
• try {
Summary of java.lang Package
• • Automatically imported package.
• • Core of the Java programming language.
• • Contains classes for:
• - Object handling
• - Strings and math operations
• - System utilities
• - Multithreading
• - Exception handling
• - Wrapper classes

You might also like