Java9ではtry-with-resource文で、try句でのリソースの変数を宣言しなくてもよくなった。
FileInputStream is = new FileInputStream("foo"); try (is) { // omit } catch (Exception e) { } // Java8 try (FileInputStream is = new FileInputStream("foo")) { // omit } catch (Exception e) { }
Java9ではtry-with-resource文で、try句でのリソースの変数を宣言しなくてもよくなった。
FileInputStream is = new FileInputStream("foo"); try (is) { // omit } catch (Exception e) { } // Java8 try (FileInputStream is = new FileInputStream("foo")) { // omit } catch (Exception e) { }