Posts

Showing posts with the label visibility scope in java

Visibility Control or Access Modifiers in Java जावा में विसिबिलिटी कण्ट्रोल या एक्सेस मॉडिफायर

In Java, access modifiers are keywords that determine the visibility or access level of classes, constructors, methods, variables, and data members. By using access modifiers, we can control how these elements are accessed from other classes or packages.  Java provides   four types   of access modifiers: जावा में एक्सेस मॉडिफायर ऐसे कीवर्ड होते हैं जो क्लास, कांस्ट्रक्टर, वेरिएबल, मेथड या डाटा मेम्बर की एक्सेस (पहुंच) या विसिबिलिटी (दृश्यता) को नियंत्रित करते हैं। इनके माध्यम से हम तय कर सकते हैं कि कौन से भाग किस क्लास या पैकेज से एक्सेस किए जा सकते हैं। जावा में निम्नलिखित चार प्रकार के एक्सेस मॉडिफायर होते हैं: a) default b) private c) protected d) public 🔸 a) default When no access modifier is specified, the member has default access. It means the member is accessible only within the same package and not from outside the package. जब किसी क्लास, मेथड या वेरिएबल के साथ कोई भी एक्सेस मॉडिफायर नहीं दिया जाता है, तब वह default माना जाता है। इसका मतलब है क...