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.
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:
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:
Class | Description |
Boolean | A boolean value of the primitive type is enclosed in an object by the boolean class. |
Byte | A value of the primitive type “byte” is encased in an object by the “Byte” class. |
Character | A value of the primitive type char is enclosed in an object by the Character class. |
Character.Subset | Particular subsets of the Unicode character set are represented by instances of this class. |
Class | A running Java application’s classes and interfaces are represented by instances of the class Class. |
Compiler | To support Java-to-native-code compilers and associated services, the Compiler class is made available. |
Double | A value of the basic type double is contained within an object by the Double class. |
Float | A value of the primitive type float is enclosed in an object by the Float class. |
Integer | A value of the primitive type int is enclosed in an object by the integer class. |
Math | The 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
Login/Signup to comment