Hi,
I'm new to Java (but not new to programming) and am a little bit confused, how Java handles the
proteced modifier. What is the reason, why Java let's you access
protected members even outside of the class-hierarchy? And what is the difference to
public?
Code:
class A{
protected int _i;
}
public class Main {
public static void main(String[] args) {
A a = new A();
int i = a._i; /* Ok! But why? And what is then the difference to public? */
}
}
Thanks for your time