When it comes to protected and private, we should analyze it from two aspects.
First, visibility
Protected: Within the package or in the outsourcing of the method belongs to the subclass of the class is visible inside, that is, the class or object within the package can be called by the method of the class object of the method, for the outsourcing of the method belongs to the class inside the child class is said, The subclass of the owning class (which is not in the same package as the parent class) can invoke the method, even if the class is not inside the package, but this subclass inherits the method that cannot be called in other classes (where the package is different from the parent class).
Private: Called only within this class, including the main function
2nd: Inheritance
Protected: Can inherit by quilt class
Private: Cannot inherit from quilt class
Java protected and private