Java Precisely

Cover Java Precisely, Second Edition, describes Java 5.0, including generics, reflection, annotations, enum types, autoboxing and so on. The book has 142 pages, a comprehensive index and 165 examples.

It is a quick reference for the reader who has learnt (or is learning) Java from a standard textbook, and who wants to know the language in more detail.

Here's a bonus note with Java performance tips (updated April 2005).

Here's another bonus note which summarizes the results of Java floating-point operations; they are as expected for the IEEE 754-2008 standard for floating-point arithmetic. (January 2009). Here are some lecture slides that explain IEEE 754 floating-point arithmetics and the accompanying Java source code.

One more bonus note about microbenchmarks in Java with source code (August 2013).

See also C# Precisely.

The third edition (2016)

Java Precisely, Third Edition, describes Java 8.0; it will appear early 2016.

Example programs from the third edition

The second edition (2005)

Java Precisely, Second Edition, describes Java 5.0 and has 142 pages, a comprehensive index and 165 examples.

Bibliographic data

P. Sestoft, Java Precisely, Second Edition, The MIT Press August 2005. ISBN 0-262-69325-9. List price: US $18.95.

Get it from or

Example programs from the second edition

The first edition (2002)

The first edition gives a concise description of the Java programming language (Java 2 JDK 1.3 and 1.4) in 107 pages plus a comprehensive index. It includes 114 examples; see below. P. Sestoft, Java Precisely, The MIT Press June 2002. ISBN 0-262-69276-7. List price: US $16.95.
Get it from or

Some reviews of the first edition

Example programs from the first edition

Disclaimer Java Precisely and its example programs come with no warranty of any kind, either expressed or implied. In no event shall I or the Royal Veterinary and Agricultural University or the IT University of Copenhagen or The MIT Press be liable for any damage resulting from its use.

The zero'th edition: old online version (2000)

The old online version (September 2000) has no material on the collection classes, on input and output, the assert statement, and a number of other things. Also, the index and the layout are better in the printed version.

License Any individual or institution has the right to download, print and reproduce the September 2000 online version of Java Precisely, but not to modify or sell it -- except that copies may be sold to students at the cost of reproduction.

Any individual or institution may make electronic copies of the September 2000 online version of Java Precisely available locally (within an organization), but not publicly, e.g. on the Internet.


Thanks to Rasmus Lund, Niels Hallenberg, Hans Henrik LÝvengreen, Christian Gram, Jan Clausen, Anders Peter Ravn, Bruce Conrad, Brendan Humphreys, Hans Rischel and Ken Friis Larsen for their useful comments, suggestions, and corrections. Special thanks to Rasmus Lund for letting me adapt his collections diagram for this book. Warm thanks to the editors Bob Prior and Deborah Cantor-Adams, and the very careful copy editor, at The MIT Press.

Java Precisely was written using the following software: Linux, GNU Emacs, LaTeX 2e, xfig, xdvi, dvips, psselect, psnup, ps2pdf, Ghostview, Adobe Acrobat Reader, Netscape Navigator, CVS, GNU make, GNU tar, sed, zip, Moscow ML, IBM's Jikes, IBM's JIT JVM for Linux, and Sun Microsystems' javac and jar.

This material is Copyright (c) 2000 Peter Sestoft and Copyright (c) 2002 and 2005 The MIT Press.

Peter Sestoft ( 2005-07-19, 2015-09-09