This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Vijitha Kumara wrote:Your example itself gives the reason. Members marked as protected are only inherited to the sub classes. You cannot use an instance of that class to access a protected member anywhere.
Protected members are accessible within the same package.