SINCE the release of the original Java Development Kit in May of 1995, the engineering team at Sun Microsystems has been hard at work improving and enhancing the Java platform. The publication of this edition coincides with the release of Version 6 of the Java Platform Standard Edition (Java SE) and reflects the API of that release.
This edition introduces new features added to the Java platform since the publication of the third edition (under release 1.3), such as a chapter on Generics and information on annotations. There are new chapters on Java Web Start, The Platform Environment, and Regular Expressions. Most chapters, such as Concurrency (formerly Threads), I/O, Object-Oriented Programming Concepts, and Language Basics, have been completely rewritten. Collections has been brought out of the appendix and into its own chapter. A new appendix contains information on how to prepare for the Java Programming Language Certification exam.
All of the material has been thoroughly reviewed by members of engineering to ensure that the information is accurate and up to date.
Like the previous editions, this book is based on the online tutorial hosted at Sun Microsystems’ Web site:
http://java.sun.com/docs/books/tutorial/
The information in this book is—often referred to as “the core tutorial” or “the basics”—that are required by most beginning to intermediate programmers. Once you have mastered the material in this book, you can explore the rest of the Java platform on the Web site.
As always, our goal is to create an easy-to-read practical programmer’s guide with lots of examples to help people learn to program.
This book is geared towards both novice and experienced programmers.
New programmers can benefit most from reading the book from beginning to end, including the step by step instructions for compiling and running your first program in Getting Started (page 1).
Programmers experienced with procedural languages such as C++ may wish to start with the material on object-oriented concepts and features of the Java programming language.
Experienced programmers may want to jump feet first into more advanced topics, such as generics, concurrency, or Java Web Start.
This book contains information to address the learning needs of programmers with various levels of experience.
This book is designed so you can read it straight through or skip around from topic to topic. The information is presented in a logical order, and forward references are avoided wherever possible.
The examples in this tutorial are compiled against the 6.0 release. You need to download this release in order to compile and run most examples.
The accompanying CD contains the content of this book (including examples, and solutions and answers to the questions and exercises), as well as the online-only Java SE tutorials, an early 6.0 release of the Java SE Development Kit (JDK), and the corresponding API specification and guide documentation.
You will see footnotes like the following:
docs/api/java/lang/Class.html
and
tutorial/deployment/applet/examples/TalkServer.java
The highest level of the CD contains docs
and tutorial
directories, so those footnotes can be located on the CD as specified. To locate the latest pages online, prepend http://java.sun.com/javase/6/
to the docs
footnotes and http://java.sun.com/docs/books/
to the tutorial
footnotes:
http://java.sun.com/javase/6/docs/api/java/lang/Class.html http://java.sun.com/docs/books/tutorial/deployment/applet/examples/TalkServer.java
The chapters in this book can be found on the CD at the following locations:
Chapter | Location |
---|---|
1. Getting Started |
|
2. Object-Oriented Programming Concepts |
|
3. Language Basics |
|
4. Classes and Objects |
|
5. Interfaces and Inheritance |
|
6. Generics |
|
7. Packages |
|
8. Numbers and Strings |
|
9. Exceptions |
|
10. Basic I/O |
|
11. Collections |
|
12. Concurrency |
|
13. Regular Expressions |
|
14. The Platform Environment |
|
15. Swing |
|
16. Packaging Programs in JAR Files |
|
17. Java Web Start |
|
18. Applets |
|
Some Linux systems automount the CD with a filesystem that forces all file names to lower case. This will break browser links to HTML files with mixed-case names, and also prevent the examples from compiling.
If you have this problem, try manually mounting the CD with the UDF filesystem. To do this:
Become superuser.
Unmount the CD:
umount
cd_device_path
Remount the CD using the UDF filesystem:
mount -t udf
cd_device_path cd_mount_point
We welcome feedback on this edition. Please use the Tutorial feedback form:
http://developers.sun.com/contact/tutorial_feedback.jsp
Many Internet readers have helped us maintain and improve the quality of the tutorial by sending us email and cheerfully pointing out typos, broken links, and areas of the tutorial that caused confusion or could benefit from rewriting.
Many current and former members of the Java Software engineering and documentation teams have given us counsel, answered our many questions, reviewed our material, and even made contributions to it. The list is long, but we would particularly like to note the contributions of Eric Armstrong, David Bristor, Martin Buchholz, Mandy Chung, Iris Garcia Clark, Margarita Fischer, Amy Fowler, Andy Herrick, Shannon Hickey, David Holmes, Jim Holmlund, Patrick Keegan, Peter Korn, Masayoshi Okutsu, Scott Seligman, Xueming Shen, Sundar Sivasubramanian, Pete Soper, Scott Violet, and Kathy Walrath. We are also grateful for the talented writers and programmers at Sun who have contributed to the online tutorial as guest authors.
We want to thank our former colleague, Joshua Bloch, the original author of the Collections chapter who made the time to provide us with updated information. Thanks also to our external reviewers and longtime supporters, Doug Lea and Brian Goetz.
Debra Scott, our manager, gave us encouragement and the support necessary to do our work — and bring it in on time.
Our program managers, Mary Lautner and Ian Hardie, tracked schedules, ran interference, and provided comic relief.
Illustrators Michael Quillman and Dwayne Wolff created the professional graphics, quickly and efficiently.
We also thank the members of the SQE team who have provided valuable feedback.
Finally, thanks to the managers in Java SE for allowing their engineers and illustrators time to devote to this effort, and particularly: Uday Dhanikonda, Frances Ho, James Hsieh, Janet Koenig, and Keith Yarwood.
Sharon Zakhour, the Tutorial team lead, has worked at Sun as a senior technical writer for seven years. She contributed to The JFC Swing Tutorial, Second Edition, and has worked with the Swing and AWT teams for several years. She graduated from UC Berkeley with a B.A. in Computer Science and has worked as a programmer, developer support engineer, and technical writer for more than twenty years.
Scott Hommel is a technical writer on staff at Sun Microsystems, where he documents the Java Platform, Standard Edition. Since 1999, he has contributed to every major release of the JDK, mostly in the form of API spec clarifications and core release documentation. He currently works from home in the green mountains of Killington, Vermont.
Jacob Royal has a master’s degree in IT and an MBA in Information Systems. He has authored administrator’s guides, API references, programmer’s guides and has identified new tools and developed code and writing standards for various companies including Lucent Technologies and Autodesk. He also contributes to the JSR APT specification and the Java deployment guides at Sun.
Isaac Rabinovitch is a freelance technical writer. He has authored user’s manuals, programmer’s guides, administrator’s manuals, API references, release notes, and support documentation at Sun, Borland, SGI, and many other companies. He is fond of technical trivia, and has been playing with computers for longer than he cares to think about.
Thomas Risser was educated in physics at Harvard (B.A.) and the University of California at Berkeley (Ph.D.). He has been a technical writer in the computer industry for fifteen years.
Mark Hoeber is a former senior technical writer at Sun Microsystems. He has worked as a technical writer for twelve years, focusing on documentation for software developers and system administrators. In addition, Mark has worked on implementing content management systems for technical writing teams.
18.190.239.166