import java.util.*;import java.lang.*;import java.io.*; class Ideone{ public static void main (String[] args) throws java.lang.Exception { try(Resource resource = new Resource()){ System.out.println("Trying"); throw new RuntimeException("Trying failed"); } }} class Resource implements Closeable { public void close(){ System.out.println("Closing"); throw new RuntimeException("Closing failed"); }}
Standard input is empty
Trying Closing
Exception in thread "main" java.lang.RuntimeException: Trying failed at Ideone.main(Main.java:11) Suppressed: java.lang.RuntimeException: Closing failed at Resource.close(Main.java:19) at Ideone.main(Main.java:9)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!