lang package in Java

lang package in Java

In this article we will be discussing about lang package in Java.

Various built-in and pre-defined packages are available in java which helps a programmer in various aspects. These built in packages contains various classes and functionalities.

 

lang package in Java

Packages in Java

Java contains numerous amount of libraries in which various method and classes are stored. There are many built-in packages such as java, lang, awt, javax, swing, net, io, util, sql etc.
And in this tutorial, we will be going to discuss about the lang package in java.

lang Package in Java

The classes that are essential to the creation of the Java programming language are contained in the Java.lang package. Using straightforward and useful examples, this tutorial and reference will walk you through each of the methods included in the java.lang package.

Some of the important Features of the java lang package are:
  • Common data types used in Java programs that are used to store data including Integer, Character, Double, Float, Long, Number, String, and void are present in java lang package.
  • Java lang package contains Compiler, Process, Process Builder, Runtime, Security Manager, System, Stack Trace Element, Thread, etc. are crucial for the safe and effective operation of a Java program.
  • It also contains some of the common numerical operations of the Strict Math class.

Example:

Run
public class Main{
    public static void main(String[] args){
        // String class is called without importing any package
        String name = "Lakshit";    
        System.out.println(name);
    }
}
Output:

Lakshit

Some of the important classes imported by the lang package are:

ClassDescription
BooleanA boolean value of the primitive type is enclosed in an object by the boolean class.
ByteA value of the primitive type “byte” is encased in an object by the “Byte” class.
CharacterA value of the primitive type char is enclosed in an object by the Character class.
Character.SubsetParticular subsets of the Unicode character set are represented by instances of this class.
ClassA running Java application’s classes and interfaces are represented by instances of the class Class.
CompilerTo support Java-to-native-code compilers and associated services, the Compiler class is made available.
DoubleA value of the basic type double is contained within an object by the Double class.
FloatA value of the primitive type float is enclosed in an object by the Float class.
IntegerA value of the primitive type int is enclosed in an object by the integer class.
MathThe elementary exponential, logarithmic, square-root, and trigonometric functions, as well as other basic mathematical operations, are covered in the Math course.

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription