Single Choice
Easy
QAssertion(A): The String class in Java is immutable.
Reason(R): Immutable object can not be modified once they are created and any operation on a String object results in the creating of a new String object.
ID: #22234
switch case in Java
103 views
Question Info
#22234Q ID
EasyDifficulty
switch case in JavaTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
-
Assertion (A): The
Stringclass in Java is immutable.- True. In Java, once a
Stringobject is created, it cannot be changed. Any modification to aStringobject results in the creation of a newStringobject.
- True. In Java, once a
-
Reason (R): Immutable objects cannot be modified once they are created, and any operation on a
Stringobject results in the creation of a newStringobject.- True. This is a correct explanation of immutability. Since
Stringobjects are immutable, any operation that appears to modify aStringactually creates a newStringobject.
- True. This is a correct explanation of immutability. Since
Correct Answer:
a) Both Assertion(A) and Reason(R) are true and Reason(R) is correct explanation of Assertion(A).
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic