Or if they do update it, to do so with your control over this updating. The code to perform the updates here is kept simple for illustration purposes. You may want to vet the data in your class. The data protected in this way is normally pivotal to the operation of the class and sub-classes, and is prefixed with the protected keyword. Summary of access types Public data is available to all classes in all packages.
Private data is available only within the class it is defined.
Protected data is available to all but alien classes in alien packages. Finally, no-modifier data is available to all classes in the package, but to no alien package class Classes and methods have access right too The access rights so far described equally apply to methods within classes. Such a method is just a sub-routine of a public method. It is part of the implementation, and not intended to be externally accessible. For classes, the public modifier is used before the main class definition in a class file.