Return to site

☕🎓JAVA CERTIFICATION QUESTION: TextBlock delimiters

· java,ocp

Given:

What is the output?

10

11

12

14

#java #certificationquestion #ocp

Let's decompose this text block.

The first line is 'j \': a letter 'j', a space ' ', and an escaping end line '\' (so no break line).

So this first line has a length of 2.

The second line is 'a \t': a letter 'a', a space ' ', a tab '\t', and a break line '\n' (implicit).

So this second line has a length of 4.

The third line is 'v \s': a letter 'v', a space ' ', a space '\s', and a break line '\n' (implicit).

So this second line has a length of 4.

The fourth line is 'a \': a letter 'a', a space ' ', and an escaping end line '\' (so no break line).

So this second line has a length of 2.