< prev index next >

test/tools/javac/TryWithResources/T7032633.java

Print this page

        

@@ -31,10 +31,17 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
 public class T7032633 {
     void test() throws IOException {
+        // declared resource
         try (OutputStream out = System.out) {
             out.flush();
         }
+
+        // resource as variable
+        OutputStream out = System.out;
+        try (out) {
+            out.flush();
+        }
     }
 }
< prev index next >