Special Edition Using Java 1.1, Third Edition


Introduction

by Joe Weber

Welcome to the amazing and dynamic world of Java! If you are brand new to Java, you're in for a treat. Java is an extremely rich language which, while simple and easy to learn, gives the programmer unprecedented access to even the most complex of tasks.

What is Java? Java is a revolutionary programming language that was introduced by Sun Microsystems in June 1995. Since that time, thousands of programmers have picked up books just like the one you hold in your hands now and have realized just how powerful the language is.

Java is an object-oriented programming language, which means that people programming in Java can develop more and more complex programs with great ease. In addition, Java has built-in support for threads, networking, and a vast variety of other tools.

This Book Is for You

If you're new to Java, this book is for you. Don't be intimidated by the size of this book. It contains a vast amount of rich information about every facet of the Java programming language, along with easy-to-follow chapters that are designed to get you started.

If you're already a Java expert, this book will become a treasured item on your shelf. Actually, it may never leave your desk. This book puts into one single source the most complete reference and set of examples on every aspect of the Java programming language ever compiled. No cur- rently available API has gone unexplored; no programming method has gone undocumented. Between the covers of this book, you find examples and explanations which will make your life as a programmer immensely easier.

How This Book Is Organized

This book has been organized into 14 parts. Each part covers a large chunk of information about how the Java programming language is organized.

Part I, "Introducing Java," introduces you to the design of the Java language and the Virtual Machine. It shows you what Java can do for you, and how it's being implemented in some programs today. Clear instructions have been included to help you get started by downloading the Java Developer's Kit and installing it.

Part II, "Getting Started," first introduces you to all the tools provided in the Developer's Kit. Each tool is shown in great detail, so you can go back and use all the features when you need them. For C and C++ programmers, Part II explores the differences between the C(++) language and gives you a quick boost to learning Java. Finally, you are introduced to object- oriented programming, one of the most powerful aspects of Java. "Getting Started" gives you a first look at how objects can help improve your development efforts.

Part III, "The Java Language," shows how Java's syntax is developed. The fundamental aspects of Java are found in its language syntax. Every program is built using the fundamentals of the language, and this part walks you through each segment. For the beginner, each of the chapters has been structured to help you become familiar with Java programming. For the expert, the individual aspects of the language are explored in great detail, making Part III a great reference as well as a learning tool.

Part IV, "Applets," is for you if you're picking up this book to learn how to write Java applets which can run on the World Wide Web. This part covers how to build applets with rich sound and animations. This part also shows you how to include applets in HTML so you can put them on your home pages, as well as how to handle international codes on the World Wide Web.

Part V, "More Java," helps you learn more about some very common aspects of Java, because you can never have enough Java. First, you explore strings. Strings are incredibly common, but so important we've included a whole chapter. Files and streams can help you store and retrieve data. Exceptions and events can help you control and protect your programs. The event structure helps you deal with asynchronous information that's otherwise a pain. Finally, Reflection teaches you how to inspect objects that already exist in Java space.

Part VI, "Applications," explains that Java isn't just for writing applets. Java applications are robust, and because they are platform independent, they can be the best reason of all to develop in the Java language.

Part VII, "Network," talks about the most important advance that Java has made over other programming languages--its integrated support for networking. Part VII teaches you first how TCP/IP (the communication protocol of the Internet) works, and then shows you in great depth how to take advantage of it. You are introduced to TCP and UDP sockets in depth, each with its own chapter.

Part VIII, "Java API," shows you why Java is so rich--because of the scope and depth of its API. The API provides you with controls from creating an URL connector, or storing a ton of data, to drawing an image on the screen. Part VIII takes you by the hand through each of the API pack- ages and shows you how to take advantage of each of these features.

Part IX, "Advanced Java," teaches you about some very complex technologies surrounding Java when you're ready to take the next step. Part IX shows you advanced techniques such as how to take advantage of the security models, stream whole object classes, perform remote execution, use the CORBA system, and package your applets and applications in a single JAR file.

Part X, "Databases," is an in-depth section about databases which IS (Information Systems) programmers will love. You are introduced first to how databases work, given a bit of history, and then you learn the terminology required to go on. Then you explore Java's JDBC interface, which allows you to connect, send, and store data to any JDBC-compliant database. Welcome to the world of platform-independent and DBMS-independent databases!

Part XI, "Debugging" teaches you all the tricks of the trade. This section will quickly become invaluable as you learn how important good debugging technique is when developing applications. You will find great references on every aspect of the sun.tools.debug package, as well as on the op-codes for Java's virtual machine.

Part XII, "Future Directions and Resources," covers Java and other resources. Because even this resource couldn't possibly answer every feasible question you have, you'll find a list of Java resources. You'll learn about the Java OS and for C and C++ programmers you'll find a great reference to see the differences between C(++) and Java.

Part XIII, "JavaScript," talks about the distant cousin to Java, JavaScript, which can help you do tasks with great ease. Because it can control the browser, it can even do some things Java can't. Part XIII teaches you JavaScript programming, so you'll be multilingual.

Part XIV, "Appendixes," covers information you will find invaluable as you continue your Java development. You find such references as a Java hierarchy diagram, a complete ASCII table, and a glossary. In addition, you see a complete reference on the Java lexicology.

Conventions Used in This Book

This book uses various stylistic and typographic conventions to make it easier to use.


NOTE: When you see a note in this book, it indicates additional information that may help you avoid problems or that should be considered in using the described features.


TIP: Tip paragraphs suggest easier or alternative methods of executing a procedure. Tips can help you see that little extra concept or idea than can make your life so much easier.


CAUTION:
Cautions warn you of hazardous procedures (for example, activities that delete files).


Special Edition Using Java 1.1, Third Edition uses hyper-text cross-references to help you access related information in other parts of the book.

See "The Object Class," Chapter 26