Home > Store

Special Edition Using Java 2 Platform

Register your product to gain access to bonus material or receive a coupon.

Special Edition Using Java 2 Platform

Book

  • Sorry, this book is no longer in print.
Not for Sale

About

FAQs

Question 1: On Page 603 the following was stated: "System.in is an instantiation of java.io.InputStream" but the java.io.InputStream is an abstract class with the abstract method - abstract int read(). An abstract class can not be instantiated so how is it possible?

Solution 1: While you can't create an instance of InputStream, it's perfectly valid to have a variable of type "InputStream" like System.in. You aren't supposed to know how it is implemented, you just use the InputStream methods to access the object.

You can discover the real class, if you like, by doing the following:
System.out.println(System.in.getClass().getName());

In my Windows 2000 system, I get "java.io.BufferedInputStream", which means that System.in is actually a chain of input streams because BufferedInputStream is a FilterInputStream that just adds buffering capabilities to an existing stream.

While I can discover the real implementation class, it's a bad idea to make use of that. It may vary from implementation to implementation since the only requirement is that System.in be an InputStream.

You don't ever need to instantiate System.in anyway, it's always there. You can replace it, though. For example, if you want to replace System.in with the contents of a file, you can do this:

//---------------------------------------------------------
// Open myinput.txt
FileInputStream newIn = new FileInputStream("myinput.txt");

// Buffer it for better performance
BufferedInputStream buffIn = new BufferedInputStream(newIn);

// Replace System.in with the new stream
System.setIn(buffIn);

//-----------------------------------------------------------



Question 2: On page 42, it states that the JDK is on the CD-ROM. Where is it?

Solution 2: There is a typo on page 42. The JDK is not on the CD-ROM. You will have to download the JDK from the JavaSoft website: http://www.java.sun.com/products/jdk/1.2/

********SEE NOTE BELOW ABOUT JDK ON MAC*************



Description

  • Copyright 1999
  • Dimensions: 7.38 X 9.125
  • Pages: 1420
  • Edition: 1st
  • Book
  • ISBN-10: 0-7897-2018-3
  • ISBN-13: 978-0-7897-2018-4

Special Edition Using Java 2 Platform is the complete programmer's tutorial/reference for Java 2 and related technologies. The book contains detailed descriptions of Sun's Java 2 standards, APIs, class libraries, and programming tools. Also includes coverage of Microsoft's Java SDK 2.0, AFC, and RNI products, ActiveX, CORBA, Java IDL, Joe, JavaBeans, and Enterprise JavaBeans. Over 20,000 lines of documented Java code show programmers the details of building sophisticated Java applications.

Downloads

Downloads


graybutt.zip - Missing files for Chapter 14 - 19.6 KB -- graybutt.zip

Sample Content

Table of Contents

Introduction.
This Book Is for You. How This Book Is Organized. Conventions Used in This Book.

I. INTRODUCTION TO JAVA.


1. What Java Can Do for You.
The Many Types of Java Applications. Learning About the Java Language. The Java Development Kit. Java Applets. Java GUI Applications. Java Command Line Applications. Java Is Client/Server. How to Stay Current.

2. Java Design.
Java Is Interpreted. Java Is Object Oriented. The Java Virtual Machine. Security and the JVM. The Java API.

3. Installing the JDK and Getting Started.
Why You Need Sun's Java Development Kit to Write Java. More on How Java Is Both Compiled and Interpreted. Getting and Installing Sun's JDK. Installing a Downloaded JDK. Testing the Java Compiler and JVM. Installing IBM's Applet Developer's Kit for Windows 3.1.

4. JDK Tools.
JDK Tools Reference. AppletViewer. java, The Java Interpreter. javac, The Java Compiler. javap, The Java Disassembler. javah C-Header and Stub File Creation. The javadoc Tool (Documentation Generator). jdb, The Java Debugger. The CLASSPATH Environment Variable. Macintosh Issues. The Java Compiler. JavaH: C-Header File Generator.

II. THE JAVA LANGUAGE.


5. Obejct-Oriented Programming.
Object-Oriented Programming: A New Way of Thinking. A Short History of Programming. A Lesson in Objects. Objects as Multiple Entities. Organizing Code. Objects and How They Relate to Java Classes. Building a Hierarchy: A Recipe for OOP Design. Java Isn't a Magic OOP Bullet.

6. HelloWorld!: Your First Java Program.
HelloWorld Application. Understanding HelloWorld. HelloWorld as an Applet—Running in Netscape. Keywords. API.

7. Data Types and Other Tokens.
Java Has Two Data Types. Learning About boolean Variables. The Various Flavors of Integer. Operators. Character Variables. Floating-Point Variables. Arrays. Whitespace. Comments. Literals: Assigning Values. Creating and Destroying Objects.

8. Methods.
Parts of a Method. Blocks and Statements. Separators.

9. Using Expressions.
What Is an Expression? How Expressions Are Evaluated. Of Special Interest to C Programmers. Bitwise Operators. The Shift Operators. Type Conversions. Addition of Strings.

10. Control Flow.
Controlling the Execution. true and false Operators on Booleans. Logical Expressions. The Conditional Operator. Booleans in Control Flow Statements. Control Flow Functions. Iteration Statements. Jump Statements.

Chapter 11. Classes.
What Are Classes? Why Use Classes? Classes in Java. Declaring a Class. Constructors. Creating an Instance of a Class. Referring to Parts of Classes. Variables. Inner Classes. Packages. Improting Classes in Packages. Importing Entire Packages. Using a Class Without Importing It. Using Packages to Organize Your Code. Implicit Import of all java.lang Classes. Import of All java.lang Classes.

12. Interfaces.
What Are Interfaces? Creating an Interface. Implementing Interfaces. Using Interfaces from Other Classes. Exceptions.

13. Threads.
What Are Threads? Why Use Threads? How to Make Your Classes Threadable. The Great Thread Race. Understanding the GreatRace. Thread Processing. Try Out the Great Thread Race. Changing the Priority. A Word About Thread Priority, Netscape, and Windows. Synchronization. Speaking with a Forked Tongue. Changing the Running State of the Threads. Obtaining the Number of Threads That Are Running. Finding All the Threads That Are Running. The Daemon Property.

14. Writing an Applet.
Java's Children. Applets and HTML. Including a Java Applet in an HTML Page. Using Java Plug-in. Begin Developing Java Applets. Exploring the Life Cycle of an Applet. An Applet That Uses Controls.

15. Advanced Applet Code.
Using the PARAM Tag. Adding Images to an Applet. Adding Sound to an Applet. Using the Applet to Control the Browser. Putting It All Together.

16. JAR Archive Files.
Why JAR? When to Use JAR Archives. JAR Archives and Security. The java.util.zip Package. JAR File Format.

17. Applets Versus Applications.
Applications Explored. Advantages of Applications. Developing Java Applications. Converting an Applet to an Application. Packaging Your Applications in Zip Format. Converting an Application to an Applet.

18. Managing Applications.
Installing Applications. Maintaining Multiple Applications on the Same System.

III. USER INTERFACE.


19. java.awt: Components.
Building GUI with java.awt. Buttons. Using Buttons with the 1.1 Event Model. Labels. Check Boxes and Radio Buttons. Choices. Lists. Text Fields and Text Areas. Scrollbars. Canvases. Common Component Methods.

20. Exceptions and Events in Depth.
Java's Exceptions. Java's Error Classes. Java's Events. Event-Handling Techniques. Keyboard and Mouse Events. The 1.0 Event Model.

21. Containers and Layout Managers.
Organizing Components. Containers. Layout Managers. Container Basics. Panels. Frames. Dialogs. ScrollPanes. Layout Managers. Insets. The Null Layout Manager. Future Extensions from Sun.

22. Graphics.
Java Graphics. paint, Update, and repaint. The Graphics Class. The Polygon Class. Drawing Text. Drawing Modes. Drawing Images. The MediaTracker Class. Graphics Utility Classes. The Color Class. Clipping. Animation Techniques. Printing.

23. JFC—Java Foundation Classes.
Java Foundation Classes. JFC: A First Look. HelloWorld. Improving HelloWorld. Adding Buttons with JFC. Adding ToolTips and Icons. Using Pop-Up Menus. Borders. Check Boxes and Radio Buttons. Applying CheckBoxPanel to Change Text Alignment. Tabbed Panes. Sliders. Progress Bars.

24. Advanced JFC.
Model-View-Control—JFC's Design. Menus and Toolbars. Lists and Combo Boxes. Using Tables. Trees. Displaying HTML with JEditor. Creating Icons. JFC Applets.

25. Images.
Drawing Images to the Screen. Producers, Consumers, and Observers. Image Filters. Copying Memory to an Image. Copying Images to Memory.Color Models.

26. Java 2D Graphics.
The Graphics2D Object. Coordinates in Java 2D. Drawing Figures. Different Strokes. Custom Fills. Transformations. Drawing Text. Drawing Images. Transparency. Clipping.

IV. IO.


27. Files, Streams, and Java.
Streams: What Are They? The Basic Input and Output Classes. Handling Files. Using Pipes. Buffered Streams. Data Streams. Byte Array Streams. Char Array Streams. Conversion Between Bytes and Characters. The StringBufferInputStream. Object Streams. Other Streams. The StreamTokenizer Class.

28. Using Strings and Text.
Introducing Strings. Using the String Class. Using the StringBuffer Class. Using the StringTokenizer Class. Dealing with Fonts.

29. Using Internationalization.
Internationalization Scenario. What Is Internationalization? Java Support for Internationalization. Input-Output (I/O) for Internationalization. The New Package java.text. An Example: InternationalTest.

30. Communications and Networking.
Overview of TCP/IP. TCP/IP Protocols. Uniform Resource Locator (URL). Java and URLs.

31. TCP Sockets.
TCP Socket Basics. Creating a TCP Client/Server Application.

32. UDP Sockets.
Overview of UDP Messaging. Creating a UDP Server. Creating a UDP Client. Using IP Multicasting.

33. java.net.
The URL Class. The URLConnection Class. The HTTPURLConnection Class. The URLEncoder Class. The URLDecoder Class. The URLStreamHandler Class. The ContentHandler Class. The Socket Class. The ServerSocket Class. The InetAddress Class. The DatagramSocket Class. The DatagramPacket Class. Multicast Sockets.

34. Java Security in Depth.
What Necessitates Java Security? The Java Security Framework. Applet Restrictions. Java Security Problems. The Java Security API: Expanding the Boundaries for Applets. The Security API.

35. Object Serialization.
What Is Object Serialization? Object Serialization Example. Writing and Reading Your Own Objects. Customizing Object Serialization.

36. Remote Method Invocation.
What Is Remote Method Invocation? Creating an Applet Client. Creating a Custom Socket. Using the Activation Model.

37. Management API.
JMAPI Components. JMAPI Applets. Creating a Managed Object. The Admin View Module.

V. DATABASES.


38. Databases Introduced.
ODBC and JDBC. Relational Database Concepts. An ODBC Technical Overview. Advanced Client/Server Concepts.

39. JDBC: The Java Database Connectivity.
JDBC Overview. JDBC Implementation. The Connection Class. Metadata Functions. The SQLException Class. The SQLWarnings Class.

40. JDBC Explored.
Statements. ResultSet Processing Retrieving Results. Other JDBC Classes. JDBC in Perspective.

VI. COMPONENT-BASED DEVELOPMENT.


41. JavaBeans.
Self-Contained Components. Important Concepts in Component Models. The Basics of Designing a JavaBean. Creating and Using Properties. Using Events to Communicate with Other Components. Introspection: Creating and Using BeanInfo Classes. Customization: Providing Custom PropertyEditors and GUI Interfaces. Enterprise JavaBeans.

42. JavaIDL: A Java Interface to CORBA.
What Is CORBA? Sun's IDL to Java Mapping. Methods. Creating a Basic CORBA Server. Creating CORBA Clients with JavaIDL. Creating Callbacks in CORBA. Wrapping CORBA Around an Existing Object. Using CORBA in Applets.

43. Java—COM Integration.
A Significant Extension. A Brief Overview of COM. Defining COM Interfaces. Compiling an ODL File. Generating a GUID. Creating COM Objects in Java. Calling Java COM Objects from Visual Basic. Calling Java Objects from Excel. Calling COM Objects from Java.

VII. ADVANCED JAVA.


44. Java Media Framework.
What Is the Java Media Framework? Creating a Media Player. The States of the Player. Adding Controls to the Player. Controlling the Player Programmatically. Linking Multiple Players. Creating Your Own Media Stream. A Larger Application.

45. Commerce and Java Wallet.
Security Support with the JCC. Commerce Messages. Creating Cassettes.

46. Data Structures and Java Utilities.
What Are Data Structures? Collections. The Vector Class. The Hashtable Class. The Properties Class. The Stack Class. The Date Class. The BitSet Class. The StringTokenizer Class. The Random Class. The Observable Class.

47. java.lang.
The java.lang Packages. The Object Class. The Class Class. The Package Class. The String Class. The StringBuffer Class. The Thread Class. The ThreadGroup Class. The Throwable Class. The System Class. The Runtime and Process Classes. The Math Class. The Object Wrapper Classes. The Character Class. The Boolean Class. The Number Class. The Integer Class. The Long Class. The Byte Class. The Short Class. The Float Class. The Double Class. The Void Class. The java.math.BigInteger Class. The java.math.BigDecimal Class. Creating a BigDecimal. The ClassLoader Class. The SecurityManager Class. The Compiler Class.

48. Reflection.
What Is Reflection? Creating a Class Knowing Only the List of Constructors. Inspecting a Class for Its Methods. Using getDeclaredMethod() to Invoke a Method. Invoking Methods That Use Native Types as Parameters. Getting the Declared Fields of a Class.

49. Extending Java with Other Languages.
Native Methods, a Final Frontier for Java. The Case for "Going Native." JNI Highlights. Writing Native Methods. Accessing Object Fields from Native Methods. Accessing Java Methods from Native Methods. Accessing Static Fields. Accessing Static Methods. Exception Handling Within Native Methods.

50. Java Versus C(++).
Common Ancestry. Basic Java Syntax. The Structure of Java Programs. Java Data Types. Objects and Classes. Aggregates: Strings, Arrays, and Vectors. Class Hierarchies and Inheritance. Statements. Name Spaces.

VIII. DEBUGGING JAVA.


51. Debugging Java Code.
The Architecture of the sun.tools.debug Package. The JDB in Depth.

52. Understanding the .class File.
A Fundamental Measurement. Elements of the .class File. Definitions. The .class File Structure. So Now What Can I Do?

53. Inside the Java Virtual Machine.
Elements of the JVM.

IX. JAVASCRIPT.


54. Java Versus JavaScript.
Java and JavaScript. JavaScript Is Not Java. Interpreted Versus Compiled. Object Based Versus Object Oriented. Strong Typing Versus Loose Typing. Dynamic Versus Static Binding. Restricted Disk Access. Different Functionality (Scope Limitations) and Code Integration with HTML. Rapid Evolution Versus Relative Stability. Libraries. JavaScript and Java Integration.

55. Starting with JavaScript.
The Basics. Your First Script. Events. Using Event Handlers. Variables. Variable Names. Variable Scope. Literals. Expressions and Operators. Control Statements. Functions in JavaScript. Arrays. Built-In Functions. Objects. A Final Example.

X. JAVA RESOURCES.


56. Java Resources.
Web Sites. Newsgroups. Mailing Lists. Support for Porting Issues.

XI. APPENDIX.


Appendix A. What's on the CD-ROM.
Example Code from the Book. Third-Party Software. Bonus Software.

Index.

Updates

Updates & Corrections


graybutt.zip - Missing files for Chapter 14 - 19.6 KB -- graybutt.zip

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020