Next: Creating Objects
Up: Classes and objects
Previous: Fields
  Contents
- We declared many fields of Body to be public; this is not always a good design idea.
- Four possible access control modifiers:
- private - members declared private are accessible only in the class itself.
- protected - accessible in the class itself, and are accessible to, and inheritable by, code in the same package, and code in subclasses.
- public - accessible anywhere the class is accessible, and inherited by all subclasses.
- package - members declared with no access modifier are accessible in the class itself and are accessible to, and inheritable by, code in the same package.
Next: Creating Objects
Up: Classes and objects
Previous: Fields
  Contents