This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Using protected in JDK6 update 20 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

Using protected in JDK6 update 20

Damilola Okuboyejo

Joined: Aug 21, 2009
Posts: 13
Hi All,

Really which Bert and Kathy are reading this!!
I noticed in JDK6 u20 d@ protected behaves just like default access (package private). Instance data with protected access can't be accessed outside of their package even NOT by a class instance member that has is-a relationship with the hosting class
Please anyone d@ has worked with JDK6 u20 should verify this


package here;

public class Utility
protected int resource;

package one;

import here;

public class Test extends Utility
public static void main(String[] argv)
Utility ut = new Utility();
ut.resource = 67; // ERROR resource can't be accessed outside of its package
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

You already asked that question here. Please UseOneThreadPerQuestion.

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Have you checked out Aspose?
subject: Using protected in JDK6 update 20
It's not a secret anymore!