Java Lang Package Tutorial

HQ » Java Tutorial » java.lang
Java Lang Package Tutorial 2018-02-18T01:46:05+00:00

Package: java.lang

The java.lang package provides classes that are fundamental to the design of the Java programming language. This is the most important package of java API. And also the most important class is Object because Object is the parent of all classes. Every classes and instances in java is a child of Object.

There are a lot of instances where we wa have to represent a value of primitive data type as if it is an object thus the java.lang package is very helpful in situation like this. The wrapper classes Boolean, Character, Integer, Long, Float, and Double serve this purpose. An object of type Double, for example, contains a field whose type is double, representing that value in such a way that a reference to it can be stored in a variable of reference type. These classes also provide a number of methods for converting among primitive values, as well as supporting such standard methods as equals and hashCode. The Void class is a non-instantiable class that holds a reference to a Class object representing the type void.

Target Audience

This section is for readers that want to learn the basic java programming. The java.lang package is necessary to learn since it provides the important classes necessary in learning java. Not only that this is to be learn by novice programmer but this package must also be mastered by an expert programmer as the java.lang package is the foundation of a java programming.

Compatibility Version

Since JDK 1.0

java.lang Package Classes

The following are the classes under the java.lang package. Please master the majority of these classes as these are all helpful.

Class Description
Boolean The Boolean class simply wraps the boolean primitive data type into an object.
Byte This class simply wraps primitive data type byte into an object.
Character The Character class wraps a value of the primitive type char in an object.
Double 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.
Float The Float class wraps a value of primitive type float in an object.
Integer The Integer class wraps the int primitive data type into an object. This class includes helpful methods in converting value from string to Integer.
Math The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.
String Java String class is represented by character strings.
StringBuffer The StringBuffer is a thread safe, mutable sequence of characters. Its much the same as String however StringBuffer can be modified.
StringBuilder The StringBuffer is a thread safe, mutable sequence of characters. Its much the same as String however StringBuffer can be modified.

Contact Info


Our Goal

JavaTutorialHQ aims to to be The Ultimate Guide on Java with hundreds of examples from basic to advance Topics.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.