The three concepts usually identified with OOP (Object
Oriented Programming) are encapsulation, inheritance, and
polymorphism. This week we look at encapsulation and
inheritance. Next week we get to polymorphism.
Chapter Eight - Classes and Objects: A Deeper Look
This chapter examines classes and objects in greater detail,
including encapsulation.
- Encapsulation
- Overloading constuctors
- The special no-argument constuctor
- The this reference
- Using set<Value>, get<Value>
and is<Value> (more encapsulation)
- Composition
- Enumerations
- Garbage collection
- Static methods and variables
- The final keyword
- Data abstraction
- packages (used a lot in real life, and often a
major stumbling block for new programmers)
- Redrawing the same random lines (A little more GUI)
Chapter Nine - Object Oriented Programming: Inheritance
This chapter covers the object oriented programming
principle of inheritance.
- Class hierarchy
- “is a” versus
“has a”
- Software re-use
- Method overriding
- Access modifiers in detail
- public
- protected
- default
- private
- The Object class (Super class to every
Java class)
- Labels with text and images (A little more GUI)
Exercises
In order to reinforce the principles you’ve learned
in these chapters, I’m asking you to do the following
programming exercise. It does not require any knowledge
of Java beyond what was covered in the first eight chapters.
- Exercise 8.5
Modifying the internal representation of a Time class.