Advertisements
Advertisements
प्रश्न
A private member method is only accessed:
विकल्प
In the scope of the same class in which it is defined.
Anywhere outside the class in which it is defined.
In the derived class.
None of the above.
MCQ
उत्तर
In the scope of the same class in which it is defined.
Explanation:
In Java, private member methods are accessible only within the class in which they are declared. The private access modifier limits the method's visibility, preventing direct access from outside the class or from derived classes.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?