I create a class, that has a few protected
members, that are completely accessible to other classes:
class MyClass {
protected String name;
}
In my opinion, this shouldn't compile:
MyClass mc = new MyClass();
mc.name = "foo";
but it works fine. When I make the member private
, it works as expected. How could this be?
A few notes, but they shouldn't make any difference I think:
- the
mc
is inside aHashMap
, - I access it inside an
Activity