Ich habe keinen Plan, wie ich die Aufgabe lösen soll. Kann mir jemand einen Tipp geben?
package de.codegym.task.task09.task0913;
import java.io.FileNotFoundException;
import java.net.URISyntaxException;
/*
Ausnahmen. Einfach Ausnahmen.
*/
public class Solution {
public static void main(String[] args) throws Exception {
//schreib hier deinen Code
try {
methode1();
} catch (NullPointerException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
}
//schreib hier deinen Code
}
public static void methode1() throws NullPointerException, ArithmeticException, FileNotFoundException, URISyntaxException {
int i = (int) (Math.random() * 4);
if (i == 0)
throw new NullPointerException();
if (i == 1)
throw new ArithmeticException();
if (i == 2)
throw new FileNotFoundException();
if (i == 3)
throw new URISyntaxException("", "");
}
}