Lernen am Samstag

This commit is contained in:
2019-11-16 16:44:25 +01:00
parent 17e4bc97f2
commit 74050c93b5
7 changed files with 375 additions and 9 deletions

View File

@@ -4,6 +4,11 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.AccessDeniedException;
import java.util.List;
import java.util.zip.DataFormatException;
/**
* @author seidecke.
*/
@@ -30,17 +35,37 @@ public class CastExceptions {
// Compilefehler, da Versuch des Casts außerhalb der Typenhierarchie
// UnterCast unter2 = (UnterCast) außerhalb;
try {
UnterCast unterCast = new UnterCast();
unter.method();
} catch (RuntimeException e) {
}
}
}
class OberCast {
public void method() throws IOException{
}
}
class UnterCast extends OberCast {
@Override
public void method() {
System.out.println("method in Untercast");
}
}
class Außerhalb {
}
class MyCheckedException extends Exception {
}