Question 25 of 509

Quick Answer

The correct answer includes `translateEscapes()`, `toLowerCase(Locale)`, and `transform(Function<String, String>)` as the three valid String methods in Java 17. These methods are all officially part of the `java.lang.String` class, though they were added in different Java versions: `translateEscapes()` arrived in Java 14 to convert escape sequences like `\n` into actual newline characters, `toLowerCase(Locale)` is a long-standing overloaded method that respects locale-specific case rules, and `transform()` was introduced in Java 12 to apply a function to the string and return the result. On the Oracle Certified Professional Java SE 17 Developer 1Z0-829 exam, this question tests your familiarity with both legacy and modern String APIs, often appearing as a multiple-select trap where candidates confuse methods from other classes like `StringBuilder` or `Character`. A common pitfall is assuming `translateEscapes()` is a static method or that `transform()` requires a specific functional interface type—remember it accepts any `Function<? super String, ? extends R>`. For a quick memory aid, think “TTL” for **T**ranslateEscapes, **T**ransform, and **L**ocale-based toLowerCase.

1Z0-829 Practice Question: Handling Date, Time, Text, Numeric and Boolean Values

This 1Z0-829 practice question tests your understanding of handling date, time, text, numeric and boolean values. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Which three of the following are valid methods in the String class in Java 17? (Choose three.)

Question 1easymulti select
Full question →

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

translateEscapes()

Option B is correct because `translateEscapes()` is a valid instance method introduced in Java 14 (and present in Java 17) that translates escape sequences (e.g., `\n` to newline) in a string. Option C is correct because `toLowerCase(Locale)` is a standard overloaded method in the String class that converts all characters to lowercase using the specified locale. Option D is correct because `transform(Function<String, String>)` is a valid method added in Java 12 that applies the given function to the string and returns the result.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • substring(int, int, Locale)

    Why it's wrong here

    Incorrect: No such overload; substring only takes start and end indices.

  • translateEscapes()

    Why this is correct

    Correct: translateEscapes was added in Java 14.

    Related concept

    Read the scenario before looking for a memorised answer.

  • toLowerCase(Locale)

    Why this is correct

    Correct: toLowerCase(Locale) is a valid overload.

    Related concept

    Read the scenario before looking for a memorised answer.

  • transform(Function<String, String>)

    Why this is correct

    Correct: transform method was added in Java 12.

    Related concept

    Read the scenario before looking for a memorised answer.

  • indent(String)

    Why it's wrong here

    Incorrect: There is indent(int) but not indent(String).

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates may confuse the `substring` method with other locale-sensitive methods like `toLowerCase(Locale)` or incorrectly assume that `indent` accepts a `String` parameter because of its name, when in fact it takes an `int`.

Detailed technical explanation

How to think about this question

The `translateEscapes()` method processes escape sequences like `\t`, `\n`, `\"`, and `\\` at runtime, converting them to their actual character representations, which is useful when reading escaped strings from configuration files or user input. The `transform` method is a generic functional interface method that allows chaining operations on strings, e.g., `str.transform(s -> s.trim()).transform(String::toUpperCase)`. The `indent` method adjusts the indentation of each line based on the integer value, adding or removing spaces, and also normalizes line terminators.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the 1Z0-829 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related 1Z0-829 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free 1Z0-829 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this 1Z0-829 question test?

Handling Date, Time, Text, Numeric and Boolean Values — This question tests Handling Date, Time, Text, Numeric and Boolean Values — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: translateEscapes() — Option B is correct because `translateEscapes()` is a valid instance method introduced in Java 14 (and present in Java 17) that translates escape sequences (e.g., `\n` to newline) in a string. Option C is correct because `toLowerCase(Locale)` is a standard overloaded method in the String class that converts all characters to lowercase using the specified locale. Option D is correct because `transform(Function<String, String>)` is a valid method added in Java 12 that applies the given function to the string and returns the result.

What should I do if I get this 1Z0-829 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This 1Z0-829 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-829 exam.