CHAPTER 2 ■ JAVA SYNTAX
Listing 2-21. A Javadoc comment for a method
/**
* This method makes a Cat object chase the given Mouse object.
* @param mouse an instance of the Mouse class for our cat to chase
*/
void chase(Mouse mouse) {
Because you probably won't need to create Javadoc for a while, let's stop there. When you do need
to know more about it, you can find the Javadoc tool home page at http://www.oracle.com/technetwork/
java/javase/documentation/index-jsp-135444.html.
Summary
So, what did we learn in this chapter?
We considered:
- The structure of a Java file, looking at statements and declarations
- The components that comprise a Java program (classes and interfaces)
- The components that comprise classes and interfaces (methods, fields,
constructors, blocks, and comments) - The basics of Javadoc
Whole books have been written about the content we covered in a single chapter, but those are
awfully dry books for a beginner. I thought it would be more fun to learn the basics and then work with
files, create animations, and create your own video games. We do all those things later in the book.I
recommend reading the chapter again, thinking about what you learned from later in the chapter as you
go. I also recommend stopping to do a little programming of your own. Try some simple things, such as
a program to print a small multiplication table (say up to 4 x 4) and a program that accepts multiple
Strings as arguments and combines them in interesting ways. There's no substitute for learning by doing
it yourself.