i didn;t understand how can i do this...need help
package com.codegym.task.task09.task0918;
/*
We're all friends here, even the exceptions
*/
public class Solution {
public static void main(String[] args) throws Exception {
method1();
}
public static void method1() throws MyException, MyException2, MyException3, MyException4 {
int i = (int) (Math.random() * 3);
if (i == 0)
throw new MyException();
if (i == 1)
throw new MyException2();
if (i == 2)
throw new ArithmeticException();
if (i == 3)
throw new IndexOutOfBoundsException();
}
static class MyException extends Exception {
}
static class MyException2 extends MyException{
}
static class MyException3 extends MyException2 {
}
static class MyException4 extends MyException3{
}
}