Chapter 5

Composing a Program

In This Chapter

arrow Reading input from the keyboard

arrow Editing a program

arrow Shooting at trouble

Just yesterday, I was chatting with my servant, RoboJeeves. (RoboJeeves is an upscale model in the RJ-3000 line of personal robotic life-forms.) Here’s how the discussion went:

Me: RoboJeeves, tell me the velocity of an object after it’s been falling for 3 seconds in a vacuum.

RoboJeeves: All right, I will. “The velocity of an object after it’s been falling for 3 seconds in a vacuum.” There, I told it to you.

Me: RoboJeeves, don’t give me that smart-alecky answer. I want a number. I want the actual velocity.

RoboJeeves: Okay! “A number; the actual velocity.”

Me: RJ, these cheap jokes are beneath your dignity. Can you or can’t you tell me the answer to my question?

RoboJeeves: Yes.

Me: “Yes,” what?

RoboJeeves: Yes, I either can or can’t tell you the answer to your question.

Me: Well, which is it? Can you?

RoboJeeves: Yes, I can.

Me: Then do it. Tell me the answer.

RoboJeeves: The velocity is 153,984,792 miles per hour.

Me: (After pausing to think . . .) RJ, I know you never make a mistake, but that number, 153,984,792, is much too high.

RoboJeeves: Too high? That’s ...

Get Beginning Programming with Java® For Dummies®, 3rd 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.