class SumberBermasalah implements AutoCloseable {
    @Override
    public void close() {
        throw new IllegalStateException("gagal menutup sumber");
    }
}

public class HanyaCloseGagal {
    public static void main(String[] args) {
        try (SumberBermasalah sumber = new SumberBermasalah()) {
            System.out.println("badan try selesai tanpa kegagalan");
        } catch (Exception e) {
            System.out.println("utama     : " + e.getClass().getSimpleName()
                    + " -> " + e.getMessage());
            System.out.println("tertindih : " + e.getSuppressed().length + " exception");
        }
    }
}
