Java - Java.lang Class Questions and Answers
The Java.lang Class questions with answers topic is a key area in Java programming questions and answers asked in major technical exams and placement tests. The java.lang package forms the foundation of Java, offering essential classes like Object, String, and Math. Understanding these concepts is vital for cracking programming interview questions at companies like TCS, Infosys, and Accenture. In this section, we’ll explore frequently asked questions about java.lang classes, constructors, and methods with detailed explanations to help you master core Java fundamentals and boost your placement preparation.
Java - Java.lang Class
Showing 10 of
24 questions
11. Which method is used to compare two objects for equality?
- equals()
- compare()
- ==
- equal()
12. What is the parent class of all exception classes?
- Throwable
- Exception
- Error
- Object
13. Which class is used for string manipulation?
- String
- StringBuffer
- StringBuilder
- All of the above
14. What does the clone() method do?
- Creates object copy
- Deletes object
- Compares objects
- Converts to string
15. Which method returns the runtime class of an object?
- getClass()
- getRuntimeClass()
- getType()
- classOf()
16. What is the purpose of the wait() method?
- Makes thread wait
- Stops program
- Terminates thread
- Pauses execution
19. Which method is used to get the length of a string?
- length()
- size()
- getLength()
- getSize()