Just Java 2, Fifth Edition, by Peter van der Linden provides a great introduction to beginner and intermediate Java programmers, as well as explaining the basics of OOP. At a hefty 1,000-plus pages, this well-written book covers everything you need to grasp the basics of Java. The book is divided into five sections:
- Part 1 covers OOP introduction and Java basics, such as statements, interfaces, and packages.
- Part 2 thoroughly explores the key APIs in J2SE 1.4, such as java.nio, an API for memory-mapped I/O, nonblocking I/O, and file locking, and java.util.regex for regular expressions.
- Part 3 examines Servlets, IP networking, and remote method invocation (RMI).
- Part 4 discusses Java GUI, such as Swing and Abstract Windows Toolkit (AWT).
- Part 5 outlines server-side Java, including enterprise JavaBeans and working with Java and relational databases.
New APIs in JDK 1.4
As I mentioned, part 2 of the book introduces some of the new APIs in J2SE 1.4, specifically java.nio and java.util.regex. Although the author covers the mildly useful javax.crypto library in the Enterprise Java section, he fails to cover the new logging facilities. However, he does offer an in-depth look at the new features of the java.nio package, including nonblocking I/O, file locking, memory-mapped I/O, and Charsets.
As the book explains, nonblocking I/O is new to Java 1.4 and allows enterprise and networked applications to read and write files and sockets without application threads becoming blocked when no data is available. File locking is also new to the Java Development Kit, and the behavior is system dependent. Some systems enforce mandatory locking, which will prevent any other applications from altering the file while the current application has the lock. Other systems use an advisory locking system, in which the other applications may or may not honor the lock a file may have on it.
The author also discusses memory-mapped I/O, a new provision that allows an application to map a system input/output buffer directly into the application’s address space. It allows both the user application and the native interfaces to read and write files directly in memory. Charsets are character encodings like ASCII. They’ve been supported in Java for quite a while, but the new features of buffers allow the programmer to decide how to deal with the byte order of data files directly. The way that Java deals with different encodings has been encapsulated into a class in the java.nio package, thus making it easier to extend and implement other character encodings.
On the lighter side
One feature I particularly liked about this book was that each chapter ends with a section titled “Some Light Relief.” These sections are intended to add a little humor, document some computer history, and remove a bit of the dryness inherent in this type of book. For instance, the section “The Illegal T-Shirt” discusses a shirt marketed by a company called Copyleft. On the shirt is a program written in C that breaks the Content Scrambling System (CSS) encryption on most commercial DVDs so that they can be copied bit for bit. The section describes how the DVD Copy Control Association sued Copyleft to get the shirt off the market and prevent knowledge of how to decrypt CSS from proliferating.
All in all, I think the author gave a thorough treatment to the subjects of object-oriented programming, Java specifics, and the new APIs available in J2SE 1.4. If you are new to Java, this is one book that should be on your bookshelf.
Review a book
If you would like to share your favorite book with the Builder.com audience, contact the editors.