O'Reilly logo

Beginning Programming with Java For Dummies, 5th Edition by Barry A. Burd

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18

Using Methods and Fields from a Java Class

IN THIS CHAPTER

check Using Java’s String class

check Calling methods

check Understanding static and non-static methods and fields

check 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.

The String Class

The String class is declared in the Java API. This means that somewhere ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required