The C# 'using' statement (not the C# 'using' directive) is a shortcut for a try/finally block which disposes an object of type System.IDisposable. Java 7 introduces the 'try with resources' statement, which operates on objects of type java.io.Closeable:
using (Foo f = new Foo())
Java 7 or higher:
try (Foo f = new Foo())
Foo f = new Foo();
Use C# to Java Converter to convert from C# to Java.
Java and C# Equivalents
Copyright © 2004 – 2019 Tangible Software Solutions, Inc.