Java - Java.lang Class Questions and Answers
Practice ModeShowing 10 of 24 questions
Q11
Which method is used to compare two objects for equality?
Answer: Option A
Explanation: equals() method checks object equality
Q12
What is the parent class of all exception classes?
Answer: Option A
Explanation: Throwable is the superclass of all errors and exceptions
Q13
Which class is used for string manipulation?
Answer: Option D
Explanation: String class provides various methods for string operations
Q14
What does the clone() method do?
Answer: Option A
Explanation: clone() creates and returns a copy of the object
Q15
Which method returns the runtime class of an object?
Answer: Option A
Explanation: getClass() returns the Class object representing runtime class
Q16
What is the purpose of the wait() method?
Answer: Option A
Explanation: wait() causes current thread to wait until another thread notifies
Q17
Which class contains the Math.abs() method?
Answer: Option A
Explanation: Math class provides static methods for mathematical operations
Q18
What is the default value of a boolean instance variable?
Answer: Option A
Explanation: boolean instance variables are initialized to false by default
Q19
Which method is used to get the length of a string?
Answer: Option A
Explanation: length() method returns the number of characters in string
Q20
What is the superclass of Number class?
Answer: Option A
Explanation: Number extends Object class directly