Chapter 7

Though These Be Methods, Yet There Is Madness in't

IN THIS CHAPTER

check Matching Java types

check Calling methods effectively

check Understanding method parameters

In Chapter 4, I compare a method declaration to a recipe for scrambled eggs. In this chapter, I compute the tax and tip for a meal in a restaurant. And in Chapter 9 (spoiler alert!), I compare a Java class to the inventory in a cheese emporium. These comparisons aren't far-fetched. A method's declaration is a lot like a recipe, and a Java class bears some resemblance to a blank inventory sheet. But instead of thinking about methods, recipes, and Java classes, you might be reading between the lines. You might be wondering why I use so many food metaphors.

The truth is, my preoccupation with food is a recent development. Like most men my age, I've been told that I should shed my bad habits, lose a few pounds, exercise regularly, and find ways to reduce the stress in my life. (I've argued to my Wiley editors that submission deadlines are a source of stress, but so far the editors aren't buying a word of it. I guess I don't blame them.)

Above all, I've been told to adopt a healthy diet: Skip the chocolate, the cheeseburgers, the ...

Get Java Programming for Android Developers For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.