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>