Possible Duplicate:
“using” keyword in java
I have one problem, In c#
"using " is keyword but how to use in java
using (layout xmds = new layout()){
}
Possible Duplicate:
“using” keyword in java
I have one problem, In c#
"using " is keyword but how to use in java
using (layout xmds = new layout()){
}
In Java 7, all classes implementing AutoCloseable can be used with the "try-with-resources" construct:
class Layout implements AutoCloseable { ... }
// Usage
try (Layout layout = new Layout()) {
// do stuff here
}
Edit: Noticed you tagged the question with "android". Android doesn't support Java 7, so you won't be able to use try-with-resources there.