From 7703533ae0a84c2edc61d167942e2e850b227de0 Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Wed, 31 Jan 2024 13:17:24 +0100 Subject: [PATCH] Regain Java 21! --- Klausuren/Sd1/2023summer/Solve/Docs/exam.xml | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Klausuren/Sd1/2023summer/Solve/Docs/exam.xml b/Klausuren/Sd1/2023summer/Solve/Docs/exam.xml index f8e04de04..0c65c70ca 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> -- GitLab