Java access modifier Protected keywords I am puzzled, many people on the internet, the self-annotation of the industry has still not eliminated my understanding of this keyword.
My doubts have the following points:
1: Add protected keyword of the original intention, that is to say: this "protected" principle is what??
2: In the Think in Java, the definition of protected is incorrect.
What is the role of 3:protected?
4: Inheritance is involved.
In the Java programming Mind: By reading, my understanding is:
There are two scenarios for inheriting classes that have protected access modifiers:
(1) Inheritance of different packages.
The book says: In a new package, the class inherits the class from the original package, and can only access the public decorated members in the original class.
(2) Inheritance in the same package:
The class object in the package can access the member variables or methods that are protected decorated
This article is from the "Night" blog, make sure to keep this source http://8991120.blog.51cto.com/8981120/1662770
Java Base access modifier protected