: Allows access only to objects in the same package (folder) and objects in an inheritance relationship
Default
: Allows access only to objects in the same package (folder) => same package
Private
: Allows access only within the current object => same class
Access Restriction
By using access restriction, data (instance variables) is blocked from direct external access, and the operations that can modify or act on the data are kept internal.
This way, the outside cannot know what changes are happening internally, and can only receive results through methods
=> Information hiding is possible
img
+
Getters Setters method
: two conventional methods that are used for retrieving and up-dating value of a variable.
In Eclipse, use the top menu: source - Generate Getters Setters method
Only for boolean types, it is is___ instead of set___!