Does java have an equivalent to the C# “using” clause

后端 未结 12 1387
温柔的废话
温柔的废话 2020-12-29 23:09

I\'ve seen reference in some C# posted questions to a \"using\" clause. Does java have the equivalent?

12条回答
  •  既然无缘
    2020-12-29 23:12

    It was a long time coming but with Java 7 the try-with-resources statement was added, along with the AutoCloseable interface.

提交回复
热议问题