Skip to content
Sharp

Modern Java · interview question

Given a Java text block, how does the compiler handle incidental whitespace?

Multiple choiceHardchapter-12-curatedpremiummodern-javatext-blocks
Choose one answer
Answer and explanation

Correct answer

A. It trims common leading whitespace from all lines.

Why

The Java compiler trims common leading whitespace from all lines in a text block. This allows you to align the text block with your code while maintaining the intended formatting.

Test yourself on Modern Java

A free test with instant, explained results. No account needed.

Start free test
All Modern Java questions →