

dots (.) are used to show spaces in code.Let’s check some examples to understand how it works in practice. In other words, left most character in content or end delimiter decides the starting character of all lines in the text block. if we move any line of content or closing delimiter to left it reduces common whitespace prefix. Now we have content and closing delimiter.There has to be one line terminator immediately after the initial opening delimiter.White space removalįollowing two rules help us understand whitespace removal.
Java text blocks code#
It makes the same java code work across all platforms. Line terminatorsĭifferent operating systems have their Line terminators.Īll line terminators (CR/LF/CRLF) in the content are translated into LF (\u000A). The following sections have all 3 steps of compile-time processing in more detail. Performing interpretation as the final step means developers can write escape sequences such as \n without them being modified or deleted by earlier steps. Line terminators: Line terminators in the content are translated to LF (\u000A).Ĭommon white spaces removal: Incidental white space surrounding the content, introduced to match the indentation of Java source code is removed in this step.Įscape sequence processing: Escape sequences in the content are interpreted in this step. The content of a text block is processed by the Java compiler in three steps in the same sequence as given below:

No issues due to space among consecutive lines.Ī text block consists of zero or more content characters, enclosed by opening and closing delimiters. Select emp_id, emp_name, emp_num_of_kids, emp_activeįollowing is console output for text blocks, it is the same as we have written in code.
