• Saves Valuable Time
  • Trusted Accuracy for 14 Years
  • 15-Day Money-Back Guarantee

Java Equivalent to the VB 'Using' Statement

The VB 'Using' statement 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 f As New Foo()
End Using

Java 7 or higher:

try (Foo f = new Foo())

pre-Java 7:

Foo f = new Foo();

Use VB to Java Converter to convert from VB to Java.     

Additional resource: VB.NET and Java Equivalents

Copyright © 1997 – 2018 Tangible Software Solutions Inc.