Advertisements
Advertisements
प्रश्न
Which of the following statements is the most appropriate for the private members?
पर्याय
They are visible out of the class in which they are defined.
They can be used in the sub-classes.
They are only visible in the class in which they are declared.
None of the above.
MCQ
उत्तर
They are only visible in the class in which they are declared.
Explanation:
Private is a keyword in programming languages that serves as an access modifier. When you declare an object as private, it can only be accessible within the class. We can, however, use the getter and setter methods to access private data. This keyword can be applied to attributes, methods, and constructors.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?