1Z0-829 Practice Question: Handling Date, Time, Text, Numeric and Boolean Values
Which three of the following are valid methods in the String class in Java 17? (Choose three.)
⚠ Common exam trap
Test-takers frequently 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`.
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()
`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.
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.
- ✓
toLowerCase(Locale)
Why this is correct
Correct: toLowerCase(Locale) is a valid overload.
- ✓
transform(Function<String, String>)
Why this is correct
Correct: transform method was added in Java 12.
- ✗
indent(String)
Why it's wrong here
Incorrect: There is indent(int) but not indent(String).
Go deeper
Related to this question
About these practice questions
This 1Z0-829 question is part of Courseiva's 513-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.