Question 1
What does this print?
public class Main {
public static void main(String[] args) {
String s = """
x
y""";
System.out.println(s);
}
}A. x yCorrect answer
Correct: the two content lines are indented 14 and 12 spaces and the closing delimiter shares the last line, so the minimum indent is 12; stripping 12 from every line leaves two spaces before the first word and none before the second, on separate lines.
B. x y
Strips per line rather than by the common minimum; the more-indented line keeps its two extra spaces because stripping is uniform by the least indentation.
C. x y
Some white space is always removed here — the compiler strips the common 12-space margin — so the raw indentation does not survive intact.
D. x y
The line terminator between the two lines is essential content and survives; nothing joins the lines onto one.
Explanation
Incidental white space is the single smallest indentation shared across the content lines and the closing delimiter's line, and exactly that amount is removed from every line uniformly. Indentation deeper than that minimum is essential and kept, so the more-indented line retains its extra spaces while the least-indented line keeps none. The line terminator between the lines is content and remains, so the two pieces print on separate lines.