Original link: http://blog.sina.com.cn/s/blog_7de00ff60102xffx.html
If you want to establish an instance of the outer class in an export Class (subclass) of an external class as an inner class of protected permission, you need to set the constructor of the inner class of the protected permission to public. Otherwise, the compiler will give an error.
We might take it for granted that, since I inherited the external class, I have the authority to build an instance of the inner class of the member of this external class--protected permission, which is actually not the case. Since we do not explicitly build the constructor of the inner class of the protected permission, the compiler will automatically build a default constructor for the protected inner class at compile time, and the access rights of the default constructor will be consistent with that of the inner class, protected, This means that only the exported class (subclass) of the inner class and the class that is similar to the inside of a package have permission to invoke the constructor of the protected permission. To create an instance of a class, it must pass through the constructor, since only the exported class (subclass) of the inner class and its constructor that is similar to the inner package class can invoke it, then it is explained by default (the constructor of the inner class that does not own the public permission). Only the exported class (subclass) of the inner class and the class with which the inner package is similar can establish an instance of it.
In summary, if we want to establish an instance of an inner class that is a member of the outer class by inheriting an external class, set the permissions of the constructor of the inner class of the protected permission to public--protected.
This problem arises in the 10th chapter of Programming thinking 6th.
Java creates an instance of the protected inner class of the outer class by inheriting the outer class (GO)