Courseiva
Primitives, Strings and OperatorshardMultiple ChoiceObjective-mapped

1Z0-811 Primitives, Strings and Operators Practice Question

Which of the following statements about the String class is true?

⚠ Common exam trap

Oracle often tests the misconception that the '+' operator modifies the original String, leading candidates to choose option A, when in fact it creates a new String object and the original remains unchanged.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Strings are immutable

String objects in Java are immutable, meaning once a String object is created, its value cannot be changed. Any operation that appears to modify a String, such as concatenation, actually creates a new String object. This immutability is a fundamental design choice that enables String pooling, thread safety, and efficient caching of hash codes.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Strings can be modified using the '+' operator

    Why it's wrong here

    Incorrect: '+' concatenation creates a new String, the original remains unchanged.

  • String objects can be created only with the 'new' keyword

    Why it's wrong here

    Incorrect: String literals also create String objects.

  • Strings are immutable

    Why this is correct

    Strings in Java are indeed immutable. This means that once a `String` object has been initialised, its sequence of characters cannot be altered. Any operation that appears to modify a string, such as concatenation or substring extraction, actually results in the creation of a *new* `String` object containing the modified value, whilst the original `String` object remains unchanged in memory. This characteristic makes the statement true regarding the `String` class.

  • String is a primitive type

    Why it's wrong here

    Incorrect: String is a class (reference type).

About these practice questions

One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.