Question
Option 3 : Each resource is closed automatically at the end of the try block / try ब्लॉक के अंत में प्रत्येक संसाधन स्वतः बंद हो जाता है
Detailed Solution
सही उत्तर Each resource is closed automatically at the end of the try block / try ब्लॉक के अंत में प्रत्येक संसाधन स्वतः बंद हो जाता है है।
Question:
Which statement about Java's try-with-resources is TRUE? / Java के try-with-resources के बारे में कौन-सा कथन सत्य है?
Correct Answer: Each resource is closed automatically at the end of the try block / try ब्लॉक के अंत में प्रत्येक संसाधन स्वतः बंद हो जाता है
Resources declared in the try-with-resources header (which must implement AutoCloseable) are closed automatically, in reverse order, when the block exits — normally or via exception. The trap option (d) ignores the AutoCloseable requirement. / try-with-resources header में घोषित संसाधन (जिन्हें AutoCloseable implement करना चाहिए) ब्लॉक से बाहर निकलते समय — सामान्यतः या अपवाद द्वारा — स्वतः, उल्टे क्रम में बंद होते हैं। जाल विकल्प (d) AutoCloseable की आवश्यकता को नज़रअंदाज़ करता है।