Chapter 4

Exploring the Parts of a Program

IN THIS CHAPTER

Bullet Identifying the words in a Java program

Bullet Using punctuation and indentation

Bullet Understanding Java statements and methods

I work in the science building at a liberal arts college. When I walk past the biology lab, I always say a word of thanks under my breath. I’m thankful for not having to dissect small animals. In my line of work, I dissect computer programs instead. Computer programs smell much better than preserved dead animals. Besides, when I dissect a program, I’m not reminded of my own mortality.

In this chapter, I invite you to dissect a program with me. I have a small program, named ThingsILike. I cut apart the program and carefully investigate the program's innards. Get your scalpel ready. Here we go!

Checking Out Java Code for the First Time

I have a confession to make. The first time I look at somebody else’s computer program, I feel a bit queasy. The realization that I don’t understand something (or many things) in the code makes me nervous. I’ve written hundreds (maybe thousands) of programs, but I still feel insecure whenever I start reading someone else’s code.

The truth is, learning about a computer program ...

Get Beginning Programming with Java For Dummies, 6th 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.