Java.lang Package Classes

Java.lang package Tutorial



Java.lang package provides classes that are fundamental to the design of the Java programming language.

About Tutorial

This tutorial is intended for students and professionals interested in studying basic and advanced concepts of Java.lang package. This tutorial covers introduction, declaration and methods of most commonly used Java classes present in Java.lang package, for example - Integer, Float, long, Double, Byte, Object, Short, String, Math, Class & Enum class. We believe in learning by examples therefore each and every topic is explained with lots of examples that makes you learn the topic in a very easy way. Along with this, almost all examples can be executed online which provides better understanding of the package and helps you to learn the concept faster. The classical example of using Java sqrt() function is mentioned below for the illustration purpose.

import java.lang.*;

public class MyClass {
 public static void main(String[] args) {
  System.out.println(Math.sqrt(25)); 
  System.out.println(Math.sqrt(30));      
 }
}

The output of the above code will be:

5.0
5.477225575051661

Prerequisite

Before continuing with this tutorial, you should have basic understanding of Java programming language. This section contains various types of examples which are used for reference and requires basic understanding of Java language.