: Allows all access
: Allows access only to objects in the same package (folder) and objects in an inheritance relationship
: Allows access only to objects in the same package (folder) => same package
: Allows access only within the current object => same class
-
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
-
+
: 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___!