Java's protected members declared in class are visible in the whole package. Why?
I simply want to share privacy between my class and it's subclasses but Java doesn't allow me.
What I am supposed to do?
Java's protected members declared in class are visible in the whole package. Why?
I simply want to share privacy between my class and it's subclasses but Java doesn't allow me.
What I am supposed to do?
 
    
     
    
    protected are sharing also between package members, so you could move your class and its children to a separate package.
 
    
    protected Members are Visible to the package and all subclasses (protected). So, Why so surprised ? .
 
    
    This is its intended behavior. All fields that are declared as protected are visible within the class, the package and all subclasses, including those outside the package.
