Commit 5e727775 authored by Dr. Martin Goik's avatar Dr. Martin Goik

Mjulti-line hint in second Xmas tree exercise

parent c46bc861
......@@ -16,7 +16,7 @@ public class App {
<title>A square table</title>
table,td,th {
table, td, th {
border: 1px solid black;
table {
......@@ -3407,17 +3407,49 @@ System.out.format("%"+ (numberOfRows + 1) + "s\n", "###");</programlisting>
in the previous exercises solution.</para>
<para>The <methodname
method allows for indenting multi line blocks:</para>
<informaltable border="1">
<th>Result ('␣' denoting space)</th>
<td valign="top"><programlisting language="none">final String block = """
<emphasis role="red">A simple block
consisting of
three lines</emphasis>""";
<td valign="top"><screen><emphasis role="red">A simple block
consisting of
three lines</emphasis>
␣␣␣␣␣␣␣␣␣␣<emphasis role="red">A simple block</emphasis>
␣␣␣␣␣␣␣␣␣␣<emphasis role="red">consisting of</emphasis>
␣␣␣␣␣␣␣␣␣␣<emphasis role="red">three lines</emphasis></screen></td>
<para>A complete solution is provided by <link
You may want to import the whole project. We start again from a
version being fully covered by our current knowledge. This time
we try printing the following lines:</para>
<programlisting language="none">Looping through <emphasis
role="red">\ /</emphasis> <emphasis role="red">Part 1: The tree's top.</emphasis>
groups of 2 lines <emphasis role="red">--&gt;*&lt;--</emphasis>
......@@ -3990,7 +4022,7 @@ System.out.format("Start:<emphasis role="red">%5d</emphasis>:End", <emphasis
&lt;!-- CSS based styling --&gt;
table,td,th {
table, td, th {
border: 1px solid black;
table {
......@@ -4030,29 +4062,7 @@ System.out.format("Start:<emphasis role="red">%5d</emphasis>:End", <emphasis
This solution uses both <xref linkend="glo_Java"/> 15 multi
line blocks and the String.<link
method. Consider the following example:</para>
<programlisting language="java">final String block = """
A simple block
consisting of
three lines""";
System.out.println("\nAgain using indentation of 10 spaces:");
<para>This creates:</para>
<screen>A simple block
consisting of
three lines
Again using indentation of 10 spaces:
A simple block
consisting of
three lines</screen>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment