Learn Java Programming - Introduction to Encapsulation - Part 2 Tutorial
In part one I introduced the concept of setter and getter methods, these methods are also known as mutator (setter) and accessor (getter) methods. Also in part one I left you hanging on how we can prevent the direct usage of our instance variables. We can control the access to our instance variables using access modifiers. The topic of access modifiers is quite extensive and there are many rules that are way beyond the scope of this tutorial. I will be covering them in detail in future tutorials, but for now I will introduce you to the access modifier private and how it affects instance variables. The access modifier private must be placed before the type when declaring an instance variable.


















