If the keyword protected is used in front of an extends clause, all inherited elements from the superclass become protected elements of the subclass. If an extends clause is a public element, all elements of the superclass are inherited with their original protection.
The color fields red, green and blue that are inherited from Color become protected fields of ColoredPoint2, since the extends clause is preceded by the protected keyword. The inherited fields from Point keep their protection status since that extends clause is preceded by public.
The prefixes protected and public are not inherited. A protected element cannot be accessed via dot notation - this is the essence of being protected. Additionally, protected elements may not be modified or redeclared in class modifications.
Look at a variable: