Multiple choice technology programming languages

Is it possible to extend the java.lang.String class?

  1. yes

  2. no java.lang.String is declared as final

  3. some times only

  4. none of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The java.lang.String class is explicitly declared with the final modifier in the Java API. This design prevents other classes from subclassing it, ensuring security, optimization, and immutability of string objects.