Chapter 3

What Java Does (and When)

In This Chapter

check1 Making decisions with Java statements

check1 Repeating actions with Java statements

check1 Adding exception handling

Human thought centers on nouns and verbs. Nouns are the “stuff,” and verbs are the stuff’s actions. Nouns are the pieces, and verbs are the glue. Nouns are, and verbs do. When you use nouns, you say, “book,” “room,” or “stuff.” When you use verbs, you say “Do this,” “Do that,” “Hoist that barge,” or “Lift that bale.”

Java also has nouns and verbs. Java’s nouns include String, ArrayList, and JFrame, along with Android-specific things such as Activity, Application, and Bundle. Java’s verbs involve assigning values, choosing among alternatives, repeating actions, and other courses of action.

This chapter covers some of Java’s verbs. In Chapter 4 of this minibook, you bring in the nouns.

Making Decisions (Java if Statements)

When you’re writing computer programs, you’re constantly hitting forks in roads. Did the user correctly type his or her password? If yes, let the user work; if no, kick the bum out. So the Java programming language needs a way of making a program branch in one of two directions. Fortunately, the language has ...

Get Android Application Development All-in-One 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.