4 ms·
>Imagine a close() interface in Java. There isn't one https://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html https://docs.oracle.com/javase/7/d
by mschulze 12y ago
>Imagine a close() interface in Java. There isn't one
https://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html https://docs.oracle.com/javase/7/docs/api/java/lang/AutoClos...
You can even leave out the finally when you use an autocloseable resource.
//r will be closed no matter what
try(Resource r = getResource()) {
} catch(SomeException e) {
}
- arnehormann 12y agoMy Java is getting rusty... I read about this sometime somewhere but forgot it, thanks! I should have picked something like "String getText()", then.