For a long time, my understanding of Java fields accessibility was wrong !!!
Here are the right accessibility for public, private, protected and package fields
private : can be accessed only from the class declaring the field
public : can be accessed from everywhere
package (when no visibility is specified) : can be accessed from every class within the same package
protected : can be accessed from any subclass OR from any class within the same package (protected = package + subclasses)
February 6, 2009 at 12:11 pm |
Very helpful and to-the-point,
thanks
February 6, 2009 at 2:34 pm |
Happy to know some of my posts are useful for others
Thanks for your comment
February 27, 2009 at 6:36 pm |
thanx thanx love the brevity
November 30, 2009 at 10:06 am |
Thanks