Conventions Used in this tutorial

The font conventions used in this tutorial are quite simple. Italic is used for:

  • Unix pathnames, filenames, and program names
  • Internet addresses, such as domain names and URLs
  • New terms where they are defined
  • Program names, compilers, interpreters, utilities, and commands
  • Threads

Constant width is used for:

  • Anything that might appear in a Java program, including method names, variable names, and class names
  • Tags that might appear in an HTML or XML document
  • Keywords, objects, and environment variables

Constant width bold is used for:

  • Text that is typed by the user on the command line

Constant width italic is used for:

  • Replaceable items in code
Java ScreenShot

This icon designates a note, which is an important aside to the nearby text.


This icon designates a warning relating to the nearby text.

In the main body of text, we always use a pair of empty parentheses after a method name to distinguish methods from variables and other creatures. In the Java source listings, we follow the coding conventions most frequently used in the Java community. Class names begin with capital letters; variable and method names begin with lowercase. All the letters in the names of constants are capitalized. We don't use underscores to separate words in a long name; following common practice, we capitalize individual words (after the first) and run the words together. For example: thisIsAVariable, thisIsAMethod( ), ThisIsAClass, and THISISACONSTANT. Also, note that we differentiate between static and nonstatic methods when we refer to them. Unlike some tutorials, we never write ) to mean the bar( ) method of Foo unless bar( ) is actually static.