以下示例用于演示Java 7和Java 9中try-with-resources在用法上的差异。
运行程序,控制台输出如下:
do something do other things other resource is closed some resource is closed do something do other things other resource is closed some resource is closed