Java - Java.lang Class Questions and Answers

Take Exam

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()
Show Answer Report

12. What is the parent class of all exception classes?

  • Throwable
  • Exception
  • Error
  • Object
Show Answer Report

13. Which class is used for string manipulation?

  • String
  • StringBuffer
  • StringBuilder
  • All of the above
Show Answer Report

14. What does the clone() method do?

  • Creates object copy
  • Deletes object
  • Compares objects
  • Converts to string
Show Answer Report

15. Which method returns the runtime class of an object?

  • getClass()
  • getRuntimeClass()
  • getType()
  • classOf()
Show Answer Report

16. What is the purpose of the wait() method?

  • Makes thread wait
  • Stops program
  • Terminates thread
  • Pauses execution
Show Answer Report

17. Which class contains the Math.abs() method?

  • Math
  • Integer
  • Number
  • Object
Show Answer Report

18. What is the default value of a boolean instance variable?

  • false
  • true
  • 0
  • null
Show Answer Report

19. Which method is used to get the length of a string?

  • length()
  • size()
  • getLength()
  • getSize()
Show Answer Report

20. What is the superclass of Number class?

  • Object
  • Number
  • Integer
  • Math
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test