Classes, Objects and Encapsulation
OOP (object-oriented programming) means writing a program as small things that hold data and the actions on that data. In Java, a class is the plan and an object is one thing built from the plan. This section covers new, access modifiers (words that say who may use a member, which is a field or a method), encapsulation (keeping data private behind methods), this (the object running the code) and null (no object at all).
After this section you can explain each of these in about a minute and predict what a short piece of code prints.
Topics in this section
- Class and object
- Creating objects with new, and reference variables
- Access modifiers
- Encapsulation, getters and setters
- The this keyword
- null and NullPointerException
- Packages