This book is about the Java programming language created by Sun Microsystems. The book is targeted toward Java developers at any level of expertise who are looking for interesting and useful APIs or for project ideas. Java has come a long way since it was first released. When I discovered Java in 1996, the version was 1.0 and only a small group of people even knew what it was. Java had no experienced developers, very few code libraries, and no enterprise servers. It was just an immature language with big dreams. But looks were deceiving; the power of the JVMís platform independence was the key to Javaís growth. Today, Java is an ubiquitous, mature technology over 10 years old. The core API itself contains over 3,000 classes in a number of subject areas. Fortune 500 companies now build their entire corporate computing strategies around Java, and millions of websites are running servlets or client-side applets.
Iím amazed at how often developers will look at the core API and think that itís all you can do with the language. Besides what is in the core, there is a great wealth of free, open-source libraries for Java. It is because of these libraries that Wicked Cool Java was born; I wanted to give you a taste of some of the interesting and useful things that Java can do. What I didnít want was to write another "how-to-program-in-Java" book - there are plenty of good books for getting people started in writing Java code. Instead, what I wanted was a book just for the joy of discovering interesting things to do in Java without reinventing the wheel. This book is intended for the programmer who has knowledge of Java from a basic to an intermediate level and is looking for ways to enhance his or her code.
The book has a lot of sample code and Hello World programs for various APIs. Some are introductory-level examples, and others are more advanced. Occasionally there are code tips, and sometimes there are ideas for new projects that could become successful open-source projects if someone would only write them! If you implement any of these project ideas, I strongly encourage you to go to the bookís website and work with other readers to avoid duplicating efforts. One of the greatest things we can do as developers is to work together and to share the fruits of our efforts with others.
Organization of This Book
This book is organized into eight chapters, each covering a particular area of Java. The following gives a short outline of each chapter:
In the first chapter, we discuss some of the core API featuresósome that are older but less well known and some that are new to Java 5. We discuss the new for loop, enums, generics, anonymous classes, and assertions.
Next we discuss String processing techniques. We start with regular expressions, and we also discuss random text, arrays, binary strings, and message formatting. Regex is a very powerful tool for searching, splitting, and substituting text. It has been around since Java 1.4, and many new Java programmers are still not familiar with it. Regular expressions are a good starting point for parsing more complex documents.
In this chapter, we process XML and HTML documents and other types of structured text. We introduce a parser generator and show some sample code for working with it.
Chapter 4 explores the Semantic Web, a next-generation web where the links are between concepts rather than documents containing text. We introduce some APIs for working with RDF and RSS.
This chapter explores scientific and mathematical applications in Java. We link to a number of open-source projects for working with different aspects of science and mathematics.
Here we talk about APIs for making it easier to develop graphical applications or to add new features.
This chapter deals with sound and music APIs, with a section on advanced thread synchronization.
The final chapter of this book looks at miscellaneous open-source projects and discusses ideas for creating your own projects and integrating code from earlier sections.