fbpx

What are the access modifiers in Java? Briefly explain each one.

  • public: The member can be accessed from any class.
  • protected: The member is accessible within the same package and by subclasses.
  • default (no modifier): The member is accessible only within the same package.
  • private: The member is accessible only within the same class.

# Dream job to realty