diff --git a/Doc/Sd1/LanguageFundamentals/languageFundamentals.xml b/Doc/Sd1/LanguageFundamentals/languageFundamentals.xml index 56b13824657293db43c8fc995e9e29a4ce7c800e..dea617dec3f0f51e84ac50ee167b78012f3f1cca 100644 --- a/Doc/Sd1/LanguageFundamentals/languageFundamentals.xml +++ b/Doc/Sd1/LanguageFundamentals/languageFundamentals.xml @@ -7054,54 +7054,53 @@ System.out.println("Value:" + a);</programlisting></td> <td colspan="2"><screen>Value:6</screen></td> </tr> </informaltable> + </figure> - <qandaset defaultlabel="qanda" - xml:id="sd1_fundamentals_qanda_plusEqual"> - <title>Strange addition</title> + <qandaset defaultlabel="qanda" xml:id="sd1_fundamentals_qanda_plusEqual"> + <title>Strange addition</title> - <qandadiv> - <qandaentry> - <question> - <para>Execute the following snippet and explain its - result:</para> + <qandadiv> + <qandaentry> + <question> + <para>Execute the following snippet and explain its + result:</para> - <programlisting language="java">byte b = Byte.MAX_VALUE; + <programlisting language="java">byte b = Byte.MAX_VALUE; System.out.println(b); b += 1; System.out.println(b);</programlisting> - </question> + </question> - <answer> - <para>In binary representation starting from Byte.MAX_VALUE - we'd see:</para> + <answer> + <para>In binary representation starting from Byte.MAX_VALUE we'd + see:</para> - <screen> 01111111 127 + <screen> 01111111 127 + 1 + 1 -------- ---- 10000000 128</screen> - <para>But a byte variable is being represented as 1-byte 2 - complement:</para> + <para>But a byte variable is being represented as 1-byte 2 + complement:</para> - <screen> 01111111 127 + <screen> 01111111 127 + 1 + 1 Overflow! -------- ---- 10000000 -128</screen> - <para>Note that assigning b = b + 1 yields a compile time - error instead:</para> + <para>Note that assigning b = b + 1 yields a compile time error + instead:</para> - <screen>Required type: byte + <screen>Required type: byte Provided: int</screen> - <para>Conclusion: the <code language="java">+=</code> operator - leads to a cyclic behaviour and thus differs from the ordinary - <code language="java">+</code> operator.</para> - </answer> - </qandaentry> - </qandadiv> - </qandaset> - </figure> + <para>Conclusion: the <code language="java">+=</code> operator + leads to a cyclic behaviour and thus differs from the ordinary + <code language="java">+</code> operator.</para> + </answer> + </qandaentry> + </qandadiv> + </qandaset> <figure xml:id="sd1_fig_OperatorAndAssign"> <title>The <code language="java">&=</code> operator</title>