Title: Access Modifiers
Course: CPS 189: Java Certification - Review, Practice & Prepare (Development) > Section: (OLDstyle) Learning Modules

Access Modifiers

Access modifiers control how a class, field, or method may be accessed outside the class.

Access modifiers include:

public – the member is accessible from all other classes.

private – the member is accessible only within the class

A class must be declared public, abstract, or final.

Generally, fields are declared private while methods are declared public.  Declaring a field or method private carries out encapsulation.

For more information, see:

- Declaring Member Variables

- Level 1 Study Materials: Unit 1