public class ExceptionUmum {
    public static void main(String[] args) {
        try {
            System.out.println(Integer.parseInt("abc"));
        } catch (NumberFormatException e) {
            System.out.println(e.getClass().getSimpleName() + " -> " + e.getMessage());
        }

        try {
            System.out.println(10 / 0);
        } catch (ArithmeticException e) {
            System.out.println(e.getClass().getSimpleName() + " -> " + e.getMessage());
        }

        try {
            int[] nilai = {70, 85, 90};
            System.out.println(nilai[5]);
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println(e.getClass().getSimpleName() + " -> " + e.getMessage());
        }

        try {
            String nama = null;
            System.out.println(nama.length());
        } catch (NullPointerException e) {
            System.out.println(e.getClass().getSimpleName() + " -> " + e.getMessage());
        }
    }
}
