Conventions Used in This Book
Body text is Times Roman, normal, like you're reading now.
A
monospaced
typewriter font
is used for:
-
Code examples and
fragments
-
Anything that might appear in a Java program, including keywords, operators, data types, method names, variable names, class names, and interface
names
-
Program output
-
Tags that might appear in an HTML document
A
bold monospaced font
is used for:
An
italicized
font is used for:
-
New terms where they are defined
-
Pathnames, filenames, and program names (however, if the program name is also the
name
of a Java class, it is given in a monospaced font, like other class names)
-
Host and domain names (java.oreilly.com)
-
URLs (http://www.cafeaulait.org/slides/)
-
Titles of other chapters and books (
JavaI/O
)
Significant code fragments and complete programs are
generally
placed into a separate paragraph, like this:
Socket s = new Socket("java.oreilly.com", 80);
if (!s.getTcpNoDelay( )) s.setTcpNoDelay(true);
When code is presented as fragments rather than complete programs, the existence of the appropriate
import
statements should be inferred. For example, in the above code fragment you may assume that
java.net.Socket
was imported.
Some examples intermix user input with program output. In these cases, the
user
input will be displayed in bold, as in this example from Chapter 9:
%
telnet rama.poly.edu 7
Trying 128.238.10.212...
Connected to rama.poly.edu.
Escape character is '^]'.
This is a test
This is a test
This is another test
This is another test
9876543210
9876543210
^]
telnet>
close
Connection closed.
The Java programming language is case-sensitive.
Java.net.socket
is not the same as
java.net.Socket
. Case-sensitive programming languages do not always allow authors to
adhere
to standard English grammar. Most of the time, it's possible to rewrite the
sentence
in such a way that the two do not conflict, and when possible I have endeavored to do so. However, on those rare occasions when there is simply no way around the problem, I have let standard English come up the loser. In keeping with this principle, when I want to refer to a class or an instance of a class in body text, I use the capitalization that you'd see in source code, generally an initial capital with internal capitalizationfor example,
ServerSocket
.
Throughout this book, I use the British convention of placing punctuation inside quotation marks only when punctuation is part of the material quoted. Although I learned grammar under the American rules, the British system has always seemed far more logical to me, even more so than usual when one must quote source code where a missing or added comma, period, or semicolon can make the difference between code that compiles and code that doesn't.
Finally, although many of the examples used here are toy examples
unlikely
to be reused, a few of the classes I develop have real value. Please feel free to reuse them or any
parts
of them in your own code. No special permission is required. As far as I am
concerned
, they are in the public domain (although the same is most definitely not true of the explanatory text!). Such classes are placed somewhere in the
com.macfaq
package, generally mirroring the
java
package hierarchy. For instance, Chapter 4's
SafePrintWriter
class is in the
com.macfaq.io
package. When working with these classes, don't forget that the compiled
.class
files must reside in directories matching their package structure inside your class
path
, and that you'll have to import them in your own classes before you can use them. The book's web page at http://www.cafeaulait.org/books/jnp3/ includes a
jar
file containing all these classes that can be installed in your class path.
|
Indicates a tip, suggestion, or general note.
|
|
|
Indicates a warning or caution.
|
|
|