File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
    Bookmark Topic Watch Topic
  • New Topic

Using protected in JDK6 update 20

 
Damilola Okuboyejo
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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

e.g

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
Posts: 2700
IntelliJ IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
You already asked that question here. Please UseOneThreadPerQuestion.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic