Friday, February 13, 2015

Headfirst Java Chapter 4

In this chapter I learned about Instance and Local variables and how they act. Instance variables are declared as part of the class and have default values, while Local variables are defined within a method and have no initial value.
This Chapter was also about encapsulation, which is the use of "getter" and "setter" methods to return variables without accessing the instance variable directly. Encapsulation is used to protect the instance variables from being accessed from outside of its class.