Copyright © 1996 by Sams.net Publishing
All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. For information, address Sams.net Publishing, 201 W. 103rd St., Indianapolis, IN 46290.
International Standard Book Number: 1-57521-157-2
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams.net Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.
| Publisher | Richard K. Swadley |
| Acquisitions Manager | Greg Wiegand |
| Managing Editor | Cindy Morrow |
| Marketing Manager | John Pierce |
| Assistant Marketing Managers | Kristina Perry Rachel Wolfe |
| Development Editor | Angelique Brittingham | Software Development Specialist | Steve Straiger |
| Editors | Margaret Bersen, Rogers Cadenhead, Kimberly Hannel, S. Kristi Hart, Tonya Simpson, Heather Stith | ||
| Indexer | Gina Brown | Technical Reviewer | Bradley Jones |
| Editorial Coordinator | Bill Whitmer | Technical Edit Coordinator | Lynette Quinn |
| Resource Coordinator | Deborah Frisby | Editorial Assistants | Carol Ackerman, Andi Richter, Rhonda Tinch-Mize |
| Cover Designer | Tim Amrhein | Book Designer | Gary Adair |
| Copy Writer | Peter Fuller | Production Team Supervisor | Brad Chinn |
| Production | Stephen Adams, Debra Bolhuis, Charlotte Clapp, Jeanne Clark, Jason Hand, Daniel Harris, Clint Lahnen, Ryan Oldfather, Casey Price, Dana Rhodes, Laura Robbins, Bobbi Satterfield, Ian Smith, Mark Walchle, Jeff Yesh | ||
From Daniel I. Joshi:
To Brad Jones who got me started on the project, and to Greg Wiegand who helped me complete it.
To Kent who needs no further introduction.
And to all of the readers who are opening their eyes to the next revolution on the Internet: the Java Revolution.
From Laura Lemay:
To Sun's Java team, for all their hard work on Java the language and on the browser, and particularly to Jim Graham, who demonstrated Java and HotJava to me on very short notice in May and planted the idea for this book.
To everyone who bought my previous books, and liked them. Buy this one too.
From Charles L. Perkins:
To Patrick Naughton, who first showed me the power and the promise of OAK (Java) in early 1993.
To Mark Taber, who shepherded this lost sheep through his first book.
Daniel I. Joshi's background includes corporate development for several Fortune 500 companies. He is one of the major contributors to Sams.net Publishing's Web Programming Unleashed. Currently, he is pursuing Internet-based contracts through his own Microsoft Solution Provider company The Joshi Group.
You can reach him by e-mail at danjoshi@joshigroup.com, or visit his company site at http://www.joshigroup.com.
Laura Lemay is a technical writer and a nerd. After spending six years writing software documentation for various computer companies in Silicon Valley, she decided writing books would be much more fun (but has still not yet made up her mind). In her spare time she collects computers, e-mail addresses, interesting hair colors, and nonrunning motorcycles. She is also the perpetrator of Teach Yourself Web Publishing with HTML in 14 Days.
You can reach her by e-mail at lemay@lne.com, or visit her home page at http://www.lne.com/lemay/.
Charles L. Perkins is the founder of Virtual Rendezvous, a company building a Java-based service that will foster socially focused, computer-mediated, real-time filtered interactions between people's personas in the virtual environments of the near future. In previous lives, he has evangelized NeXTSTEP, Smalltalk, and UNIX, and has degrees in both physics and computer science. Before attempting this book, he was an amateur columnist and author. He's done research in speech recognition, neural nets, gestural user interfaces, computer graphics, and language theory, but had the most fun working at Thinking Machines and Xerox PARC's Smalltalk group. In his spare time, he reads textbooks for fun.
You can reach him via e-mail at virtual@rendezvous.com, or visit his Java page at http://rendezvous.com/java.
As a reader, you are the most important critic and commentator of our books. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way. You can help us make strong books that meet your needs and give you the computer guidance you require.
Do you have access to CompuServe or the World Wide Web? Then check
out our CompuServe forum by typing GO
SAMS at any prompt. If you prefer the World
Wide Web, check out our site at http://www.mcp.com.
| Note |
If you have a technical question about this book, call the technical support line at (800) 571-5840, ext. 3668. |
As the team leader of the group that created this book, I welcome your comments. You can fax, e-mail, or write me directly to let me know what you did or didn't like about this book-as well as what we can do to make our books stronger. Here's the information:
| FAX: | 317/581-4669 |
| E-mail: | programming_mgr@sams.mcp.com |
| Mail: | Greg Wiegand
Comments Department Sams Publishing 201 W. 103rd Street Indianapolis, IN 46290 |
The World Wide Web, for much of its existence, has been a method for distributing passive information to a widely distributed number of people. The Web has, indeed, been exceptionally good for that purpose. With the addition of forms and image maps, Web pages began to become interactive-but the interaction was often simply a new way to get at the same information. The limitations of Web distribution were all too apparent once designers began to try to stretch the boundaries of what the Web can do. Even other innovations, such as Netscape's server, that push to create dynamic animations were merely clever tricks layered on top of a framework that wasn't built to support much other than static documents with images and text.
Enter Java and the capability for Web pages to contain Java applets. Applets are small programs that create animations, multimedia presentations, real-time (video) games, multi-user networked games, and real interactivity-in fact, most anything a small program can do, Java applets can. Downloaded over the Net and executed inside a Web page by a browser that supports Java, applets are an enormous step beyond standard Web design.
The disadvantage of Java in the beginning was that to create Java applets, you needed to write them using a text editor and the Java Development Kit. Java is a programming language, and as such, creating Java applets is more difficult than using HTML to create a Web page or a form. Today, Symantec Café has made creating Java applets much easier. And the only way to truly appreciate Symantec Café is to also understand Java itself.
That's why Teach Yourself Café in 21 Days is designed to give you both. This book teaches you all about the Java language and how to use it to create not only applets, but also applications, which are more general Java programs that don't need to run inside a Web browser. By the time you get through with this book, you'll know enough about Java to do just about anything, inside an applet or out. You will also learn how to use Symantec Café, and how to take advantage of it to be a more productive Java programmer.
Teach Yourself Café in 21 Days describes Java primarily in its current state-what's known as the 1.0 API (Application Programming Interface). This is the version of Java that Netscape and other browsers, such as Internet Explorer 3.0, support. A previous version of Java, the alpha API, was significantly different from the version described in this book, and the two versions are not compatible with each other. Symantec Café includes the 1.0 API with its program.
The 1.0 API is, as of this writing, the most current version, the one supported by Java-enabled browsers like Netscape Navigator 2.0 or later, and the one most likely to be supported in the future.
Java is still in development. Even though the term "Beta" no longer appears, Java is still not complete, and some things may change between the time this book is being written and the time you read it. Keep this in mind as you work with Java and with the software you'll use to create and compile programs. If things aren't behaving the way you expect, check the Web sites mentioned at the end of this introduction for more information.
Teach Yourself Café in 21 Days covers the Java language and its class libraries in 21 days, organized as three separate weeks. Each week covers a different broad area of developing Java applets and applications.
In the first week, you'll learn about the basics of the Java language and Symantec Café:
Week 2 is dedicated to developing your Java understanding-especially in creating Java applets and using the Java class libraries:
Week 3 finishes up with advanced topics, for when you start doing larger and more complex Java programs or when you want to learn more on a specific area in Java:
Text that you type and text that should appear on your screen is presented in monospace type:
It will look like this.
to mimic the way text looks on your screen. Variables and placeholders will appear in monospace italic.
The end of each chapter offers common questions asked about that day's subject matter with answers from the authors.
Before, while, and after you read this book, there are two Web sites that may be of interest to you as a Java developer. The official Java Web site is at http://java.sun.com/. At this site, you'll find the Java development software, the HotJava Web browser, and online documentation for all aspects of the Java language. It has several mirror sites that it lists online, and you should probably use the site "closest" to you on the Internet for your downloading and Java Web browsing. There is also a site for developer resources, called Gamelan, at http://www.gamelan.com/.
The official site for Symantec Café is http://café.symantec.com. Here you will also get information on Java and Java news, and you can get updates and the latest information for Symantec Café.