Java Protected Access Not Working
问题 In java, there's three levels of access: Public - Open to the world Private - Open only to the class Protected - Open only to the class and its subclasses (inheritance). So why does the java compiler allow this to happen? TestBlah.java: public class TestBlah { public static void main(String[] args) { Blah a = new Blah("Blah"); Bloo b = new Bloo("Bloo"); System.out.println(a.getMessage()); System.out.println(b.getMessage()); //Works System.out.println(a.testing); System.out.println(b.testing);