Courseiva

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

Which of the following correctly creates a text block in Java?

⚠ Common exam trap

A common mix-up: candidates confuse the text block delimiter (""") with a regular string that uses escape sequences, leading them to choose option D, which incorrectly mixes explicit \n with the text block syntax.

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

"""line1 line2"""

It uses the Java text block syntax, which starts and ends with three double-quote characters (""") and places the content on a new line after the opening delimiter. The text block preserves the line break and indentation, making it ideal for multi-line strings without escape sequences.

Answer analysis

Option-by-option breakdown

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

  • "line1\nline2"

    Why it's wrong here

    Incorrect: This is a regular string with escape sequence, not a text block.

  • """line1 line2"""

    Why this is correct

    Correct: Text block spans multiple lines and preserves indentation.

  • 'line1\nline2'

    Why it's wrong here

    Incorrect: Single quotes are not valid for strings in Java.

  • """line1\nline2"""

    Why it's wrong here

    Incorrect: Text blocks must start on a new line after the opening delimiter; escapes are not needed.

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 →

How Courseiva writes practice questions · Editorial policy

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.