HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Second Edition now available! |
Follow your own path to expertise with this self-guided tour of the Java programming language. Written by two members of the JavaSoft team at Sun, the book employs a hands-on interactive approach to teaching Java basics, object-oriented concepts, applet programming, and everything else you need to know to become a proficient Java programmer.
Through plentiful examples and skill-building exercises, The Java Tutorial introduces you to fundamental concepts and applications. Designed so that you can customize your own path through the specific information you need to learn, the book explains the nuts and bolts of the language, applet construction, and the core Java classes. You will also learn about more advanced topics such as creating a user interface with Java, threads programming, working with Java's networking and security capabilities, and adding non-Java libraries to Java applications.
The accompanying CD-ROM contains the tutorial and all its code samples, the Java Developers Kit (JDK), and code for all the winning applets in the Java International Programming Contest as well as developer tools from MetroWerks, SunSoft, Symantec, and others.
Trail Map.
Getting Started.
Lesson 1: The "Hello World" Application.
Lesson 2: The "Hello World" Applet.
Common Compiler and Interpreter Problems (and Their Solutions).
End of Trail.
Writing Java Programs.
Lesson 3: Object-Oriented Programming Concepts: A Primer.
Lesson 4: The Nuts and Bolts of the Java Language.
Lesson 5: Objects, Classes, and Interfaces.
End of Trail.
Writing Applets.
Lesson 6: Overview of Applets.
Lesson 7: Creating an Applet User Interface.
Lesson 8: Communicating with Other Programs.
Lesson 9: Understanding Applet Capabilities and Restrictions.
Lesson 10: Finishing an Applet.
Common Applet Problems (and Their Solutions).
End of Trail.
Using the Core Java Classes.
Lesson 11: The String and StringBuffer Classes.
Lesson 12: Setting Program Attributes.
Lesson 13: Using System Resources.
Lesson 14: Handling Errors Using Exceptions.
Lesson 15: Threads of Control.
Lesson 16: Input and Output Streams.
End of Trail.
Creating a User Interface.
Lesson 17: Overview of the Java UI.
Lesson 18: Using Components, the GUI Building Blocks.
Lesson 19: Laying Out Components Within a Container.
Lesson 20: Working with Graphics.
End of Trail.
Custom Networking and Security.
Lesson 21: Overview of Networking.
Lesson 22: Working with URLs.
Lesson 23: All About Sockets.
Lesson 24: All About Datagrams.
Lesson 25: Providing Your Own Security Manager.
End of Trail.
Integrating Native Methods into Java Programs.
Lesson 26: Step By Step.
Lesson 27: Implementing Native Methods.
End of Trail.
Appendixes.
Appendix A: Code Examples.
Appendix B: Reference.
Colophon.
Example Index.
Index. 0201634546T04062001
Many excellent and varied histories of the Java language have been written. We will not attempt to record that history here, or even rewrite the history itself. Just let it be said "and unto James Gosling Java was born." From this birth came the need for the Java team to spread the word about this technology and teach people how to use it. And from that came the opportunity for us to write this tutorial.
From the beginning our intention has been to create an easy-to-read, fun, task-oriented tutorial with lots of practical examples that help people learn how to program in Java.
The first draft of the tutorial was made available on-line at our Web site, http://java.sun.com/
, in May 1995. This draft contained a few basic lessons on writing applets, the fundamentals of the language itself, and some key classes. Since then, the tutorial has grown to contain 7 trails containing 27 lessons covering topics ranging from applet communication to writing native methods.
We wanted to give customers early access to this material so that they could learn Java before any books were on the market. In the year after the tutorial first appeared on our Web site, we released several drafts of the tutorial to the Web site. Internet readers benefited from this early access, and so did we -- Internet readers helped us a great deal and improved the quality and usability of this tutorial by sending us feedback on our prose, examples, and style.
Internet programmers, novice and experienced alike, will benefit from this book. The book begins by presenting you with two Java programs -- one application and one applet -- and shows you how to compile and run these programs. This first section also describes how these programs work.
From this hands-on beginning, you can follow your own course of learning. New programmers will want to read the book from beginning to end, including the beginning material on object-oriented concepts, the standard features of the Java language, and the object-oriented features of the Java language. Programmers experienced with procedural languages such as C may wish to skip the section that describes the standard features of Java and start with the material on object-oriented concepts and the object-oriented features of Java. Experienced object programmers may want to jump feet first into the trail on applets. No matter what type of programmer you are, you will find a path through this book that fits your learning requirements.
If you are developing applets, you will need a Java-compatible browser, such as HotJava or Netscape 2.0, or an applet viewer such as the one that's included with the JDK. For information about the browsers and other applet viewers that are currently available, see the Web page for this book: http://java.sun.com/books/Series/Tutorial/index.html.
Finally, you need an editor that can save files in ASCII format with a .java
extension. On Solaris, this means you can use your favorite editor: vi, emacs, textedit, or some other editor. On Windows NT/95 use NotePad or a similar editor. On a Macintosh use an editor such as BBEdit or SimpleText.
A million thanks go to the Java team members who answered questions, reviewed material, and in some cases contributed examples -- all of this in the face of tight deadlines: Thomas Ball, Brenda Bowden, David Brown, Patrick Chan, Tom Chavez, David Connelly, Pavani Diwanji, Amy Fowler, Jim Graham, Herb Jellinek, Jonni Kanerva, Doug Kramer, Eugene Kuerner, Tim Lindholm, Ron Mandel, Henry McGilton, Marianne Mueller, Scott Rautmann, Benjamin Renaud, Hassan Schroeder, Richard Scorer, Sami Shaio, Arthur van Hoff, Frank Yellin, and Steve Zellers.
Painful though it may have been, our reviewers provided us with invaluable feedback on the manuscript: Mike Ballantyne, Richard Campione, Lee Collins, Greg Crisp, Matt Fahrner, Murali Ghanta, Bill Harts, Eileen Head, Murali Murugan, Roberto Quijalvo, Philip Resnik, Roger Riggs, Roman Rorat, Neil Sundaresan, Michael Weiss, the ones who preferred to remain anonymous, and all of the Internet readers who were kind enough to take the time to send us e-mail and let us know of problem areas.
Chris Warth spent several weeks writing scripts and filters to convert our complex web of HTML pages into MIF format and was most patient with us in spite of our demands and changes. Marsh Chamberlain designed and created our trail icons, and Jan Karrman provided us with the html2ps script, which we used to create PostScript files from HTML and print our first review copy of the manuscript. Nathan Walrath created the figure in the Trail Map section. When we both went on maternity leave after giving the book to Addison-Wesley, Randy Nelson served as our backup, taking care of the CD-ROM and the Web site for the tutorial.
The staff at Addison-Wesley -- Mike Hendrickson, Katie Duffy, Pamela Yee, and Marty Rabinowitz -- were professional, competent and courteous throughout the development of this book and provided us with guidance, encouragement, and instruction. They also managed the practical things like copyediting, page design, graphics, and reviewers so all we had to do was worry about content.
And finally, Lisa Friendly, The Java Series editor, our manager, and our friend, made this book possible by suggesting that we turn the online tutorial into a book. She kept us calm, reassured us often, and managed everything from our relationship with Addison-Wesley to consistency with other books in the series. Without her encouragement and hard work, this tutorial would not exist.
Kathy: This book is dedicated to my husband, Nathan Walrath, who played Mr. Mom during the months when I couldn't help out much at home. He even helped with the content, drawing the trail map figure and providing insight into the animation section. This book is also dedicated to our daughter Laine and to the baby who's pushing up against my ribs as I write this. They both help me remember that there's more to life than work.
And now that we've delivered this book, we're taking some time off to deliver our other babies...
0201634546P04062001