Why is v.v accessible if MyTest is not a parent-class of Val?
public class MyTest
{
public static void main (String args [])
{
ValX v = new ValX ();
System.out.println ("A: " + v.v); // is working, why?
}
}
public class ValX extends Val
{
}
public class Val
{
protected float v = 11;
}
EDIT
I learned about the visibility of proteced within the package. Thats the reason. thanks!
Is there a way I can make v only visible to parent-classes without moving it to another package?