public class TangkapStackOverflow {
    static int hitungMundur(int n) {
        return hitungMundur(n + 1);
    }

    public static void main(String[] args) {
        try {
            hitungMundur(1);
        } catch (StackOverflowError e) {
            System.out.println("tertangkap: " + e.getClass().getSimpleName());
            System.out.println("pesan     : " + e.getMessage());
        }
        System.out.println("program tetap berjalan");
    }
}
