Given the following code, why is it that I'm able to access a protected variable in a class that is neither in the same package nor extends the class that declared the variable?
public class B{
protected String s = "B1";
public B() {};
}
public class P{
public void out(Object o){
System.out.println(o);}
}
public class M{
B b = new B();
P.out(b.s);}
Why can the out method access b.s?