"using" keyword in java

Jla picture Jla · May 31, 2010 · Viewed 21.8k times · Source

Does Java have a using statement that can be used when opening a session in hibernate?

In C# it is something like:

using (var session = new Session())
{


}

So the object goes out of scope and closes automatically.

Answer