import java.io.*; public class FinallyTest { public static void main(String[] args) { try { //System.exit(0); // the only thing preventing "finally" throw new EOFException(); } catch (EOFException e) { e.printStackTrace(); throw new ClassCastException(); } finally { System.out.println("Finally"); } } }