IN THIS CHAPTER
Using Java’s String class
Understanding static and non-static methods and fields
Making numbers look good
Ihope you didn’t read Chapter 17, because I tell a big lie at the beginning of that chapter. Actually, it’s not a lie. It’s an exaggeration.
Actually, it’s not an exaggeration. It’s a careful choice of wording. In Chapter 17, I write that the gathering of data into a class is the start of object-oriented programming. Well, that’s true. Except that many programming languages had data-gathering features before object-oriented programming became popular. Pascal had records. C had structs.
To be painfully precise, the grouping of data into usable chunks is only a prerequisite to object-oriented programming. You’re not really doing object-oriented programming until you combine both data and methods in your classes.
This chapter starts the data-and-methods ball rolling, and Chapter 19 rounds out the picture.
String class is declared in the Java API. This means that somewhere ...