Loading…
Loading…
Ten exam-style questions on charAt and substring boundaries, indexOf including the Java 21 ranged overloads, compareTo, replace, strip versus trim, indent and stripIndent, isBlank, format specifiers and method chaining, with explanations.
Practice questions for the article Java String Methods: Indexing, Searching, Comparing and Transforming Text.
The questions follow Java 21 rules, as on the 1Z0-830 exam. Write out the indexes of each string before tracing, and remember that String methods return new values. Aim for at least 8 out of 10 before moving on.
Quiz path: step 20. Take the quizzes in this order, after reading each article.
Previous quiz: Strings, Concatenation and Immutability (OCP 21)
Next quiz: StringBuilder (OCP 21)
10 questions · pass at 68%
Check your understanding; you see the answers and explanations after submitting.
Discussion
Sign in to ask a question or share what you learned.