Exploring the Parts of a Program
IN THIS CHAPTER
Identifying the words in a Java program
Using punctuation and indentation
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 when I start reading someone else’s code.
The truth is, learning about a computer program is a ...