Summary
In this chapter the authors start working with object-oriented programming in more detail. They use playing cards as the example. You start by creating a Card object and by doing so you learn class variables, immutable variables using the final keyword, the equals and compareTo methods, and creating an array of cards. The chapter then introduces you to several search methods.
Chapter Slides
Try It – Step by Step
- Card Objects
- Card toString
- Class Variables
- The compareTo Method
- Cards Are Immutable
- Arrays of Cards
- Sequential Search
- Binary Search
- Tracing the Code
- Recursive Search
Supplementary Videos
The following video by LearningLad provides supplementary information.