Advertisements
Advertisements
प्रश्न
Find the access specifier which prohibits a class member from being used outside a class:
विकल्प
Private
Public
Protected
None
MCQ
उत्तर
Private
Explanation:
When a class member (such as a variable or method) is marked as private, it is inaccessible from outside the class. It can only be accessed within the same class where it was declared. This enables encapsulation by prohibiting direct access to the class's internal details.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?