Lang Programming Questions & Answers

Explore model answers categorized by subjects like Java, HTML, DBMS, and more.

Lang Programming Questions & Answers

what is the difference between an object and object reference?

Answer:
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.

what is the use of java.lang.Class class?

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

what is the difference between String and String Buffer?

Answer:
Object’s of String class is immutable and object’s of String Buffer class is
mutable moreover String Buffer is faster in concatenation.

what is the use of Math class?

Answer:
Math class provides methods for mathematical functions.

Can you instantiate Math class?

Answer:
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.

what will Math. abs () do?

Answer:
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.

what will Math. cell () do?

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

what will Math. floor () do?

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

what will Math. ax () do?

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

what will Math. in() do?

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

what will Math. Random () do?

Answer:
The random () method returns random number between 0.0 and 1.0. It always returns double.