File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

Using protected in JDK6 update 20

Damilola Okuboyejo

Joined: Aug 21, 2009
Posts: 12
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.
I agree. Here's the link:
subject: Using protected in JDK6 update 20
Similar Threads
Protected methods
question about member variable
Confused in Access control topic
Protected with JDK6 update 20
When I need to use a protected access modifier?