Question:
Which of the following is FALSE about packages?
पैकेज (Packages) के बारे में निम्नलिखित में से कौन-सा कथन गलत है?
Options:
- Packages cannot provide controlled access.
- Packages are used to prevent naming conflicts.
- Packages are considered data encapsulation.
- Packages are used to prevent naming conflicts, and packages are considered data encapsulation.
- पैकेज नियंत्रित पहुँच (controlled access) प्रदान नहीं कर सकते हैं।
- पैकेज का उपयोग नामकरण संबंधी विरोधों (naming conflicts) को रोकने के लिए किया जाता है।
- पैकेज को डेटा इनकैप्सुलेशन माना जाता है।
- पैकेज का उपयोग नामकरण संबंधी विरोधों को रोकने के लिए किया जाता है, और पैकेज को डेटा इनकैप्सुलेशन माना जाता है।
Correct Answer: a)
Explanation:
In programming languages like Java, packages group related classes and interfaces together. They provide access protection (controlled access) using access specifiers (such as package-private, protected, etc.). Therefore, the statement that ‘packages cannot provide controlled access’ is FALSE. Packages also prevent naming conflicts and support encapsulation.
जावा जैसी प्रोग्रामिंग भाषाओं में, पैकेज संबंधित क्लास और इंटरफेस को समूहीकृत करते हैं। वे एक्सेस मॉडिफायर (जैसे पैकेज-प्राइवेट, प्रोटेक्टेड आदि) का उपयोग करके नियंत्रित पहुँच (controlled access) प्रदान करते हैं। इसलिए, यह कथन कि ‘पैकेज नियंत्रित पहुँच प्रदान नहीं कर सकते’ गलत है। पैकेज नामकरण टकराव को रोकने और डेटा इनकैप्सुलेशन में भी मदद करते हैं।