Skip to content
Snippets Groups Projects
Commit b6b9ee20 authored by Goik Martin's avatar Goik Martin
Browse files

Adding Array creation of reference type Rectangle

parent 3d60e5bb
No related branches found
No related tags found
No related merge requests found
......@@ -258,7 +258,7 @@ primes[4] = 11;
</figure>
<figure xml:id="sd1_array_fig_arrayInitByValueSet">
<title>One step initialization</title>
<title>Primitive data one step initialization </title>
<para>Combining array allocation and value assignment:</para>
......@@ -281,6 +281,36 @@ primes[4] = 11;</programlisting></td>
</informaltable>
</figure>
<figure xml:id="sd1_array_fig_arrayInitReftypeByValueSet">
<title>Reference data one step initialization </title>
<para>Combining array allocation and value assignment:</para>
<informaltable border="0">
<colgroup width="45%"/>
<colgroup width="55%"/>
<tr>
<td valign="top"><programlisting language="java">public class Rectangle {
private int width, height;
private boolean hasSolidBorder;
public Rectangle(int width, int height,
boolean hasSolidBorder) {
this.width = width;
this.height = height;
this.hasSolidBorder = hasSolidBorder;
}
}</programlisting></td>
<td valign="top"><programlisting language="java">final Rectangle[] rectList = new Rectangle[] {
new Rectangle(2, 5, true),
new Rectangle(4, 1, false)
};</programlisting></td>
</tr>
</informaltable>
</figure>
<qandaset defaultlabel="qanda" xml:id="sd1QandaArray2html">
<title>Converting string arrays to <xref linkend="glo_HTML"/>.</title>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment