Looking for Java job? Don’t know how to prepare?. Then do not worry, we’ve a right answer for your job interview preparation. If you are preparing for Java.lang package job interview and don’t know how to crack interview and what level or difficulty of questions to be asked in job interviews then go through Wisdomjobs Java.lang package interview questions and answers page to crack your job interview. Java.lang package provides classes that are fundamental to the design of the Java programming language. The most important classes are Object, which is the root of the class hierarchy, and Class, instances of which represent classes at run time. Please have a look at our Java.lang package job interview questions and answers page to win your job.
Question 1. What Is The Base Class Of All Classes?
Answer :
java.lang.Object
Question 2. What Do You Think Is The Logic Behind Having A Single Base Class For All Classes?
Answer :
Question 3. Why Most Of The Thread Functionality Is Specified In Object Class?
Answer :
Basically for interthread communication.
Question 4. Is String A Wrapper Class Or Not?
Answer :
No. String is not a Wrapper class.
Question 5. How Will You Find Length Of A String Object?
Answer :
Using length () method of String class.
Question 6. How Many Objects Are In The Memory After The Exaction Of Following Code Segment?
Answer :
String str1 = "ABC";
String str2 = "XYZ";
String str1 = str1 + str2;
There are 3 Objects.
Question 7. 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.
Question 8. What Will Trim () Method Of String Class Do?
Answer :
Trim () eliminate spaces from both the ends of a string.
Question 9. 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.
Question 10. What Is The Possible Runtime Exception Thrown By Sub String () Method?
Answer :
ArrayIndexOutOfBoundsException.
Question 11. What Is The Difference Between String And String Buffer?
Answer :
Object's of String class is immutable and object's of StringBuffer class is mutable moreover String buffer is faster in concatenation.
Question 12. What Is The Use Of Math Class?
Answer :
Math class provides methods for mathematical functions.
Question 13. 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.
Question 14. 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.
Question 15. What Will Math. Ceil() Do?
Answer :
This method returns always double, which is not less than the supplied value. It returns next available whole number.
Question 16. What Will Math. Floor () Do?
Answer :
This method returns always double, which is not greater than the supplied value.
Question 17. What Will Math.max () Do?
Answer :
The max () method returns greater value out of the supplied values.
Question 18. What Will Math.min () Do?
Answer :
The min () method returns smaller value out of the supplied values.
Question 19. What Will Math. Random () Do?
Answer :
The random () method returns random number between 0.0 and 1.0. It always returns double.
Java.lang package Related Tutorials |
|
---|---|
Adv Java Tutorial | J2EE Tutorial |
Core Java Tutorial | JSP Tutorial |
Java-Springs Tutorial | Java Tutorial |
Java 8 Tutorial |
Java.lang Package Practice Test
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.