Header Ads

  • Breaking Now

    Can protected or friendly features be accessed from different packages?

    No,when features are friendly or protected they can be accessed from all the classes in that package but not from classes in another package.


    1. protected class can be accessed from outside of the package if the outside class extends this protected class, even if it is in different package.

    2. You can access the protected properties of other classes in outside the package through the INHERITANCE. But default modifier CAN NOT. that is the major difference between protected & default.


    Post Top Ad

    Post Bottom Ad