Top 19 Java.lang Package Interview Questions You Must Prepare 25.Apr.2024

The min () method returns smaller value out of the supplied values.

This method returns always double, which is not less than the supplied value. It returns next available whole number.

String str1 = "ABC";

String str2 = "XYZ";

String str1 = str1 + str2;

There are 3 Objects.

It simply returns the absolute value of the value supplied to the method, i.e. gives you the same value. If you supply negative value it simply removes the sign.

The java.lang. Class class is used to represent the classes and interfaces that are loaded by a java program.

Using length () method of String class.

Object's of String class is immutable and object's of StringBuffer class is mutable moreover String buffer is faster in concatenation.

The max () method returns greater value out of the supplied values.

The random () method returns random number between 0.0 and 1.@It always returns double.

No. It cannot be instantiated. The class is final and its constructor is private. But all the methods are static, so we can use them without instantiating the Math class.

An object is an instance of a class. Object reference is a pointer to the object. There can be many references  to the same object.

No. String is not a Wrapper class.

Math class provides methods for mathematical functions.

Trim () eliminate spaces from both the ends of a string.

This method returns always double, which is not greater than the supplied value.