Új hozzászólás Aktív témák
-
válasz
Ablakos
#12026
üzenetére
Remelem nem gond az angol:
Catch Block
You can add a catch block to a try-with-resources block just like you can to a standard try block. If an exception is thrown from within the try block of a try-with-resources block, the catch block will catch it, just like it would when used with a standard try construct.Before the catch block is entered, the try-with-resources construct will attempt to close the resources opened inside the try block. In case an exception is thrown when attempting to close one of the resources, these exceptions will be available from the exception's getSuppressed() method inside the catch block. Here is an example of a Java try-with-resources block with a catch block attached:
try(AutoClosableResource resourceOne = new AutoClosableResource("One", true)) {
resourceOne.doOp(true);
} catch(Exception e) {
Throwable[] suppressed = e.getSuppressed();
throw e;
}
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- KIÁRUSÍTÁS - HP Elite / ZBook Thunderbolt 3 Dock (akár 2x4K felbontás)
- iKing.Hu - Xiaomi 15T Pro 12GB/256GB Mocha Gold használt, karcmentes 6 hónap garancia
- Sandisk Portable SSD 2TB!
- Eladó Samsung S23 Ultra 8/256GB / 12 hó jótállás / ÚJ AKKUMULÁTORRAL!
- Apple iPhone 16 Pro 128 GB Natural Titanium 2027.01.28-ig ISTYLE Garancia Beszámítás Házhozszállítás
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: Central PC számítógép és laptop szerviz - Pécs
Város: Pécs

