Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using protected in JDK6 update 20

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
}
}
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
You already asked that question here. Please UseOneThreadPerQuestion.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic