Wednesday, April 18, 2007

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.

2 comments :

Whts in a name..... on February 22, 2008 at 2:17 AM said...

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.

Nomesh on March 1, 2010 at 12:28 AM said...

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.

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2016. Reads: best tracker