Commit 48a641d4 authored by Dr. Martin Goik's avatar Dr. Martin Goik

Cosmetics

parent edade91c
......@@ -1906,6 +1906,7 @@ System.out.println(a + "+" + b+ "=" + (a + b));</programlisting></td>
<tr>
<td valign="top"><programlisting language="java"
linenumbering="unnumbered">public class HelloWorld {
public static void main(String[] args) {
int a = 4,
b = 7;
......@@ -1916,6 +1917,7 @@ System.out.println(a + "+" + b+ "=" + (a + b));</programlisting></td>
<td valign="top"><programlisting language="java"
linenumbering="unnumbered">public class HelloWorld {
public static void main(String[] args) {
int a = 4,
b = 7;
......
......@@ -2364,8 +2364,10 @@ Arrow value: 10173</screen>
<figure xml:id="sd1_fig_intLiteralLimitExcess">
<title>Know your limits!</title>
<programlisting language="java">System.out.println(10000000000<emphasis
role="red">L</emphasis>); // o.K.
<programlisting language="java">System.out.println(1000000000); // o.K.
System.out.println(2147483647); // o.K.: Largest int value 2^31 - 1
System.out.println(10000000000<emphasis role="red">L</emphasis>); // o.K.: Using type long
System.out.println(10000000000 ); // Compile time error: Integer number larger
// than 2147483647 (2^31 - 1, Integer.<link
xlink:href="https://docs.oracle.com/javase/10/docs/api/java/lang/Integer.html#MAX_VALUE">MAX_VALUE</link>)
......@@ -3619,14 +3621,27 @@ System.out.println("Olympic winter games: " + year);</programlisting>
<para>Expect the unexpected:</para>
<figure xml:id="sd1_fig_byteLitteralAssign">
<title>Strange things</title>
<title>Strange things I</title>
<programlisting language="java">byte count = 91; // o.K.
int i = 91;
byte count2 = i; // Compile error: Incompatible types
// Required: byte Found: int
byte points = 130; // Compile error: Incompatible types
// Required: byte Found: int</programlisting>
</figure>
<figure xml:id="sd1_fig_byteLitteralAssign2">
<title>Strange things II</title>
<programlisting language="java">final int i = 91;
byte count = i; // o.K.</programlisting>
</figure>
<figure xml:id="sd1_fig_byteOverflow">
<title>Arithmetic overflow pitfalls</title>
......
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