diff --git a/Doc/Sd1/Appendix/Exam/2021/Winter/exam.xml b/Doc/Sd1/Appendix/Exam/2021/Winter/exam.xml index 8cfb234d33f85bc3cc9d67b11eb58e6be19b990c..4cef0a594d693aaf475a8bb3eada39f155490e37 100644 --- a/Doc/Sd1/Appendix/Exam/2021/Winter/exam.xml +++ b/Doc/Sd1/Appendix/Exam/2021/Winter/exam.xml @@ -115,7 +115,7 @@ <orderedlist> <listitem> <para>Is this implementation correct regarding the <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/Object.html#hashCode()">contract + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/Object.html#hashCode()">contract between <methodname>equals()</methodname> and <methodname>hashCode()</methodname></link>? Correct if necessary.</para> @@ -242,7 +242,7 @@ public static byte getAverage(byte a, final byte b, final byte c) { <tip> <para><methodname - xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-17-doc/api/java.base/java/lang/Math.html#round(double)">Math.round(double)</methodname> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-21-doc/api/java.base/java/lang/Math.html#round(double)">Math.round(double)</methodname> might be your friend.</para> </tip> </question> @@ -254,9 +254,9 @@ public static byte getAverage(byte a, final byte b, final byte c) { language="java">+=</code>'s way of cycling through a <code language="java">byte</code>'s range when exceeding <code language="java" - xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-17-doc/api/java.base/java/lang/Byte.html#MAX_VALUE">Byte.MAX_VALUE</code> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-21-doc/api/java.base/java/lang/Byte.html#MAX_VALUE">Byte.MAX_VALUE</code> or <code language="java" - xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-17-doc/api/java.base/java/lang/Byte.html#MIN_VALUE">Byte.MIN_VALUE</code> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-21-doc/api/java.base/java/lang/Byte.html#MIN_VALUE">Byte.MIN_VALUE</code> boundaries. Consider:</para> <informaltable border="1"> @@ -366,17 +366,17 @@ System.out.println("Result: " + of overflow errors with respect to the given context of summing up three byte values. Choosing <code>short</code> is sufficient for adding either <code language="java" - xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-17-doc/api/java.base/java/lang/Byte.html#MAX_VALUE">Byte.MAX_VALUE</code> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-21-doc/api/java.base/java/lang/Byte.html#MAX_VALUE">Byte.MAX_VALUE</code> or <code language="java" - xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-17-doc/api/java.base/java/lang/Byte.html#MIN_VALUE">Byte.MIN_VALUE</code> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-21-doc/api/java.base/java/lang/Byte.html#MIN_VALUE">Byte.MIN_VALUE</code> even three times in a row.</para> <para>Dividing by 3 should be a floating point rather than an integer operation to avoid cutting off fractional values. On top we finally use the <classname - xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-17-doc/api/java.base/java/lang/Math.html">Math</classname><code + xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-21-doc/api/java.base/java/lang/Math.html">Math</classname><code language="java">.</code><methodname - xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-17-doc/api/java.base/java/lang/Math.html#round(double)">round(double)</methodname> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-21-doc/api/java.base/java/lang/Math.html#round(double)">round(double)</methodname> method avoiding rounding errors like the one shown previously.</para> diff --git a/Doc/Sd1/Appendix/Exam/2023/Summer/exam.xml b/Doc/Sd1/Appendix/Exam/2023/Summer/exam.xml index 334698f01dd780aeb925501a1d00ee81cd4450f6..bef8f1ae23f3216ab3a764aa777f56ef53396e3c 100644 --- a/Doc/Sd1/Appendix/Exam/2023/Summer/exam.xml +++ b/Doc/Sd1/Appendix/Exam/2023/Summer/exam.xml @@ -206,7 +206,7 @@ <para>This way both implementations are in complete sync. (At least despite runtime efficiency and possible <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/OutOfMemoryError.html">OutOfMemoryError</link>s)</para> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/OutOfMemoryError.html">OutOfMemoryError</link>s)</para> </answer> </qandaentry> </qandadiv> @@ -227,12 +227,12 @@ int a = ...; ... try { String s = (String) o; // May throw a <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> int c = 4 / a; // May throw an <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> -} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> e) { + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> +} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> e) { System.err.println(e.getMessage()); -} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> e) { +} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> e) { System.err.println(e.getMessage()); }</programlisting> @@ -259,14 +259,14 @@ try { <answer> <para>Both <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> and <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> are being derived from their common parent <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link>. + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link>. All three classes share the common <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/Throwable.html">Throwable</link>#<link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/Throwable.html#getMessage()">getMessage()</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/Throwable.html">Throwable</link>#<link + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/Throwable.html#getMessage()">getMessage()</link> method by inheritance without redefining it.</para> <para>Our two <code>catch</code> clauses may thus be combined into @@ -275,17 +275,17 @@ try { <programlisting language="java">... try { String s = (String) o; // May throw a <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> int c = 4 / a; // May throw an <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> -} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link> e) { // Common parent class + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> +} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link> e) { // Common parent class System.err.println(e.getMessage()); }</programlisting> <para>Caveat: There is a <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/RuntimeException.html#class-description">whole + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/RuntimeException.html#class-description">whole bunch of other child classes</link> of <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link>. + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link>. The simplified version thus potentially catches additional exceptions we might not be aware of. On the other hand the <code language="java">try {...}</code> block does not contain an diff --git a/Klausuren/Sd1/2021winter/Exam/src/main/java/de/hdm_stuttgart/mi/sd1/task2/SquarePolynom.java b/Klausuren/Sd1/2021winter/Exam/src/main/java/de/hdm_stuttgart/mi/sd1/task2/SquarePolynom.java index 0368a93d37467588becc172114f86ff56f3e5be3..82fea8f8e1a67888f8ed662a3a0f1d7e21dc122e 100644 --- a/Klausuren/Sd1/2021winter/Exam/src/main/java/de/hdm_stuttgart/mi/sd1/task2/SquarePolynom.java +++ b/Klausuren/Sd1/2021winter/Exam/src/main/java/de/hdm_stuttgart/mi/sd1/task2/SquarePolynom.java @@ -208,7 +208,7 @@ package de.hdm_stuttgart.mi.sd1.task2; * satisfying the corresponding unit tests.</li> * * <li><a href= - * "https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-17-doc/api/java.base/java/lang/Math.html#sqrt(double)" + * "https://freedocs.mi.hdm-stuttgart.de/lib/openjdk-21-doc/api/java.base/java/lang/Math.html#sqrt(double)" * >Math.sqrt(...)</a> * </li> * diff --git a/Klausuren/Sd1/2023summer/Solve/Docs/exam.xml b/Klausuren/Sd1/2023summer/Solve/Docs/exam.xml index f8e04de04c3961cd2b63e05b6ded01442f30014d..0c65c70cadd11579eb10811bca9beeaf0830c1ab 100644 --- a/Klausuren/Sd1/2023summer/Solve/Docs/exam.xml +++ b/Klausuren/Sd1/2023summer/Solve/Docs/exam.xml @@ -193,12 +193,12 @@ int a = ...; ... try { String s = (String) o; // May throw a <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> int c = 4 / a; // May throw an <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> -} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> e) { + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> +} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> e) { System.err.println(e.getMessage()); -} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> e) { +} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> e) { System.err.println(e.getMessage()); }</programlisting> @@ -225,14 +225,14 @@ try { <answer> <para>Both <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> and <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> are being derived from their common parent <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link>. + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link>. All three classes share the common <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/Throwable.html">Throwable</link>#<link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/Throwable.html#getMessage()">getMessage()</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/Throwable.html">Throwable</link>#<link + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/Throwable.html#getMessage()">getMessage()</link> method by inheritance without redefining it.</para> <para>Our two <code>catch</code> clauses may thus be combined into @@ -241,10 +241,10 @@ try { <programlisting language="java">... try { String s = (String) o; // May throw a <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ClassCastException.html">ClassCastException</link> int c = 4 / a; // May throw an <link - xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> -} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-17-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link> e) { // Common parent class + xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</link> +} catch (<link xlink:href="https://freedocs.mi.hdm-stuttgart.de/doc/openjdk-21-doc/api/java.base/java/lang/RuntimeException.html">RuntimeException</link> e) { // Common parent class System.err.println(e.getMessage()); }</programlisting> </answer> diff --git a/Klausuren/pom.xml.reference b/Klausuren/pom.xml.reference index bad52f3a6a05bb82eae0a5dad78760b67962f0f0..b0a82e66c595e82f79390bdd7c3ee65a468a0159 100644 --- a/Klausuren/pom.xml.reference +++ b/Klausuren/pom.xml.reference @@ -18,7 +18,7 @@ <maven.compiler.source>17</maven.compiler.source> <freedocs.url>https://freedocs.mi.hdm-stuttgart.de</freedocs.url> - <jdk.api_17.url>${freedocs.url}/doc/openjdk-17-doc/api/</jdk.api_17.url> + <jdk.api_17.url>${freedocs.url}/doc/openjdk-21-doc/api/</jdk.api_17.url> <mathjax.url>${freedocs.url}/lib/MathJax/es5/tex-chtml.js</mathjax.url> <libhighlight.url>${freedocs.url}/lib/highlight.js</libhighlight.url> </properties>