Java SE 8 OCA exam: Chapter 4

As the previous optimization attempt went well, where I studied for chapter 6, I would like to do the same for chapter 4. In this attempt, I will get specific parts of chapter 4, that will be useful for chapter 5, and once I understand the concepts, I will switch to chapter 5.

Applying Access Modifiers

You already saw that there are four access modifiers: public, private, protected, and
default access. We are going to discuss them in order from most restrictive to least restrictive:
private: Only accessible within the same class
default (package private) access: private and other classes in the same package
protected: default access and child classes
public: protected and classes in the other packages

Private Access

Private access is easy. Only code in the same class can call private methods or access
private fields.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s