Access Specifiers
Understand the details of access specifiers in Java.
We'll cover the following...
Introduction
In Java, there are four types of access specifiers: private
, public
, protected
, and default
.
In this unit, we’ll focus on private
and public
specifiers. Obvious from their names, public
means accessible from any class, and private
means accessible within the class where defined. Let’s go over them in detail.
Instance variables
In the previous lesson, we made the Employee
class. First, we add instance ...