Java.lang package Tutorial

The Java.lang package contains classes that are essential to the Java programming language’s design.

About Tutorial

This course is for students and professionals who want to learn the fundamentals and advanced ideas of the Java.lang package. This lesson goes through the basics of the most often used Java classes in the Java.lang package, such as Integer, Float, Long, Double, Byte, Object, Short, String, Math, Class, and Enum. Because we believe in learning by doing, each topic is taught with several examples, allowing you to grasp the material quickly. Furthermore, virtually all examples may be completed online, allowing you to have a deeper grasp of the package and master the topic faster. For the sake of clarification, I’ve included a classic example of utilising the Java sqrt() method.

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

You should have a basic grasp of the Java programming language before continuing with this lesson. This section offers a variety of examples that are meant to be used as a guide. And need a basic familiarity with the Java language.

To open the online compiler click here.

Also Read: Java – Data Types

Leave a Reply

Your email address will not be published. Required fields are marked *