Java Lang Package Tutorial

java.lang package provides classes that are fundamental to the design of the Java programming language. This tutorial will take you through all the methods available in java.lang package using a simple and practical example.

Audience

This tutorial has been prepared for the beginners to help them understand the basic functionality related to all the classes and it's methods available in Java.lang package.

Package java.lang Description

The most important classes are Object, which is the root of the class hierarchy, and Class, instances of which represent classes at runtime.
Frequently it is necessary to represent a value of primitive type as if it were an object. The wrapper classes Boolean, Character, Integer, Short, Byte, Long, Float, and Double serve this purpose.

The classes String, StringBuffer, and StringBuilder similarly provide commonly used operations on character strings.

Class Throwable encompasses objects that may be thrown by the throw statement. Subclasses of Throwable represent errors and exceptions.

Following are a list of classes under java.lang package. I explained all the methods with lots of examples from each class. Our suggestion is to do lots of hands experience using this tutorial.

Click on each class will navigate to their respective page.

>> java.lang Object Class

The Object class, in the java.lang package sits at the top of the class hierarchy tree. Every class is a descendant, direct or indirect, of the Object class. In this article, you will learn all the Object class methods with examples.

>> java.lang Boolean Class

The Boolean class wraps a value of the primitive type boolean in an object. An object of type Boolean contains a single field whose type is boolean. In this article, you will learn all the Boolean class methods with examples.

>> java.lang Byte Class

In this article, you will learn all the Byte class methods with examples. The Byte class wraps a value of primitive type byte in an object. An object of type Byte contains a single field whose type is a byte.

>> java.lang Character Class

In this article, you will learn all the Character wrapper class methods with examples. The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field whose type is char.

>> java.lang Double Class

In this article, you will learn all the Double wrapper class methods with examples. The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double.

>> java.lang Float Class

In this article, you will learn all the Float wrapper class methods with examples. The Float class wraps a value of primitive type float in an object. An object of type Float contains a single field whose type is a float.

>> java.lang Long Class

In this article, you will learn all the Long wrapper class methods with examples. The Long class wraps a value of the primitive type long in an object. An object of type Long contains a single field whose type is long.

>> java.lang Integer Class

In this article, you will learn all the Integer wrapper class methods with examples. The Integer class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int.

>> java.lang.Number Class

In this tutorial, we will discuss the important and commonly used Number class methods with examples.

>> java.lang.Package Class

In this tutorial, we will discuss the important and commonly used Package class methods with examples.

>> java.lang Short Class

In this article, you will learn all the Short wrapper class methods with examples. The Short class wraps a value of primitive type short in an object. An object of type Short contains a single field whose type is short.

>> java.lang Enum Class

In this article, we will learn basics and create an Enum datatype in real time projects with lots of examples.

>> java.lang String Class

In this article, we will learn all the String methods with examples. As we know Strings are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects.

>> java.lang StringBuilder Class

In this article, we will learn all the StringBuilder methods with examples.Java StringBuilder class is used to create a mutable (modifiable) string. The Java StringBuilder class is same as StringBuffer class except that it is non-synchronized. It is available since JDK 1.5.

>> java.lang StringBuffer Class

In this article, we will learn all the StringBuilder methods with examples. Java StringBuffer class is used to create mutable (modifiable) string. The StringBuffer class in Java is the same as String class except it is mutable i.e. it can be changed.

>> java.lang Thread Class

In this article, we will learn about Thread Class and it's methods with examples. Thread creates a new thread of execution. It implements the Runnable interface. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently.

>> java.lang ThreadLocal Class

Java ThreadLocal is used to create thread-local variables. We know that all threads of an Object share its variables, so the variable is not a thread safe. We can use synchronization for thread safety but if we want to avoid synchronization, we can use ThreadLocal variables.

>> java.lang ThreadGroup Class

In this article, we will learn how to group threads in Java. Java provides a convenient way to group multiple threads in a single object. Java thread group is implemented by java.lang.ThreadGroup class.

>> java.lang Throwable Class

The Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement. Similarly, only this class or one of its subclasses can be the argument type in a catch clause.

>> java.lang Comparable Interface

The Comparable interface has a single method called compareTo() that you need to implement in order to define how an object compares with the supplied object.

>> java.lang Runnable Interface

The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread. The Runnable interface defines a single run() method, which contains a code that executed in the thread. The Runnable object is passed to the Thread constructor.

Top Java Tutorials


Comments