Bird
0
0

What is a unique feature of the String class in Java compared to most other classes?

easy📝 Conceptual Q1 of 15
Java - Strings and String Handling
What is a unique feature of the String class in Java compared to most other classes?
AStrings are primitive data types in Java.
BStrings can only be created using the new keyword.
CStrings do not support concatenation.
DStrings are immutable, meaning their values cannot be changed after creation.
Step-by-Step Solution
Solution:
  1. Step 1: Understand immutability

    Strings in Java cannot be altered once created; any modification creates a new string.
  2. Step 2: Compare with other classes

    Most other objects are mutable unless explicitly designed otherwise.
  3. Final Answer:

    Strings are immutable, meaning their values cannot be changed after creation. -> Option D
  4. Quick Check:

    Strings cannot be changed after creation [OK]
Quick Trick: Strings cannot be changed once created [OK]
Common Mistakes:
  • Thinking strings are mutable like other objects
  • Assuming strings are primitive types
  • Believing strings cannot be concatenated

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes