<<

APPENDIX A

The Java API Packages

The JDK provides many packages (JDK 1.1 had 26 packages) and others are being developed (such as the 2D, 3D and Media packages). You must prefIx the names of the packages in Table A.I with "java.".

TABLE A.1 The Java API packages PackaKe name Contents applet Applet related classes awt Platform-independent windowing classes awt.datatransfer Support for cut and paste style operations awt.event DeleKation event model classes awt.image Image manipulation classes awt.peer Native windowing facilities classes beans Beans facilities for developers io Input and output classes lang Basic Java classes lang. reflect Java reflection classes math BigDecimal and BigInteger classes net Java networking facilities rmi Remote method invocation classes rmi.dgc Distributed garbage collection rmi.registry Facilities for mapping names to remote objects rmi.server Facilities for the server side of RMI security Java Security for signed applets security.acl Access control list security. interfaces Digital Signature Algorithm interface specifIcations sql JDBC SQL interface classes text Internationalization facilities 428 Java and Object Orientation

util General utili classes util.zip Java Archive (JAR) su ort classes

For further information on these packages, see books such as Chan and Lee (1996) and Gosling and Yellin (1996). APPENDIXB

The java.lang Package

B.l INTRODUCTION

The java. lang package contains the classes and interfaces which are the basis of the Java environment (as distinct from the Java language). For example, the class Obj ect (the root of all classes) is defined in this package. This package is automatically imported into every Java program (whether it is an application or an applet). The facilities provided by this package are, therefore, always available. Notice that the errors and exceptions generated directly by the Java Virtual Machine are defined in this package. Figure B.1 shows the classes and interfaces defined in this package and the relationships between them. A solid line indicates inheritance; a dashed line indicates an implementation; a rectangle indicates a class; and an oval indicates an interface.

B.2 THE CLASSES

The Obj ect class is the root of the class hierarchy. Every class has Obj ect as a superclass. All objects, including arrays, implement the methods of this class.

Boolean The wrapper for the primitive type boolean. It provides methods for working with boolean values and converting boolean values to strings and vice versa.

429 430 Java and Object Orientation

Byte final Serializable java.io Double final Float final Integer final Object Long final Short ( Cloneable final

( Runnable

Error ThreadDeath

Exception

FIG. B.1 The java.lang package Character The wrapper for char values. It provides methods for manipulating and converting chars (e.g. from uppercase to lowercase).

Class Instances represent classes and interfaces in a running Java application. Objects are constructed automatically by the Java Virtual Machine and by calls to the defineClass method in the class loader.

ClassLoader An abstract class, of which subclasses extend the manner in which the Java Virtual Machine dynamically loads AppendixB 431

Compiler Support and related services for Java-to-native-code compilers.

Math Many standard mathematical operations such as tan, cos, etc. To promote portability, the algorithms that implement the mathematical operations must match the output of algorithms available from the network library (netlib) package "Freely Distributable Math Library".

Number An abstract class, which is the superclass of Byte, Double, Float, Integer, Long, and Short. Subclasses must provide methods to convert the represented numeric value to byte, double, float, int, long, and short. . Byte The wrapper class for byte values. Double The wrapper class for double values. Float The wrapper class for float values. Integer The wrapper class for int values. Long The wrapper class for long values. Short The wrapper class for short values. Process Allows native operating system programs to be run via the exec command (or one of its variants).

Run time Environment and system related functions such as garbage collection, tracing and library loading.

Securi tyManager An abstract class that allows applications to implement their own security policy.

String Character strings which cannot be changed.

StringBuffer Sequences of characters which can be altered. The primary methods used with this class are insert and append.

System A variety of utility methods such as standard input, standard output, and error output streams; access to externally defined properties; a way of loading fIles, libraries and interfaces to the Run time class.

Thread Lightweight processes, called threads. A java program can have multiple, potentially interacting, threads. 432 Java and Object Orientation

ThreadGroup An instance represents a group of threads that can be treated as a single entity.

Throwable The root of all error or exception classes.

Error Indicator of a serious problem in a program (programs are not expected to catch errors).

ThreadDeath Although a subclass of Error, it is not really an error condition; it is generated when a thread terminates. You should only need to catch an instance of ThreadDeath if the program performs housekeeping (or similar) activities when a thread terminates.

Exception The root class of all exception classes in Java.

void An uninstantiable placeholder that references the primitive Java type void.

B.3 THE INTERFACES

Serializable Defines the common protocol for objects which can be saved to a file (defined in the java.io package, but implemented by many classes in this package).

Cloneable Indicates that the implementing object can be cloned (i.e. you can copy this object field by field).

Runnable Defines the common protocol for objects which expect to be run in their own thread. APPENDIXC

The java.util Package

C.l INTRODUCTION

This package provides a variety of utility classes such as Date and Random, as well as the Vector and HashTable growable data structures.

SeriaIizabIe ).. ..' • .,. ( java.lang ~:. >... . ~,;;;,;.;.;.;;~ - - .... ' . .. ' ~:;;=;:~~

( Enumeration )

( EvenU.lstener ) TooManyUstenetlException ( OblefVef )

RuntimeException java.1ang

FIG.C.l The java.util package

433 434 Java and Object Orientation

C.2 THE CLASSES

BitSet A growable index of bits (boolean values) which provides logical operators such as or and xor, as well as operations to set and reset bits in the set.

Calendar Provides conversion functions between date objects and integer fields representing dates. Subclasses interpret a date according to the rules of a specific calendar system, for example GregorianCalendar.

Date Represents a particular date and time.

Dictionary An abstract superclass of classes which associate a key with a value (see Hashtable).

EventObj ect The root for all event objects (for example, AWTEvnt).

GregorianCalendar Implements the Gregorian calendar, with AD and BC dates.

Hashtable Implements a traditional hashtable.

Locale Represents a region (geographical, political or cultural).

ResourceBundle Contains locale-specific objects which programs can load. The program code can be largely independent of the user's locale; most, if not all, of the locale-specific information is in the resource bundles.

ListResourceBundle An abstract subclass of ResourceBundle which handles resources in a list oriented manner.

PropertyResourceBundle An abstract subclass of ResourceBundle which handles resources using a set of static strings from a property fIle.

Observable An abstract superclass of classes that can have observers associated with them and respond to the setChanged and notifyObservers methods. Properties Instances represent system (and user) properties, such as user name, etc. AppendixC 435

Random An instance generates a stream of pseudo-random numbers.

TimeZone Instances represent time zones, such as GMT.

SimpleTimeZone Defines a time zone for use with the Gregorian calendar class.

Stack A basic stack type class, of which instances are growable.

StringTokenizer Instances of this class allow a string to be broken down into tokens identified by delimiters (Le. space, period, etc.).

Vector Implements a growable array of objects.

C.3 THE INTERFACES

Enumeration Instances which implement this interface generate a series of elements. Successive calls to the nextElement method return successive elements of the series.

EventListener The root of all event listeners.

Observer The common protocol for all classes which wish to take part in an observer-oberservable dependency relationship.

C.4 THE EXCEPTIONS

EmptyStackException Raised by the Stack class when asked to return a value from an empty stack.

MissingResourceException Indicates that a resource is missing.

NoSuchElementException Raised by a class implementing the Enumeration interface when the nextElement is sent and there are no remaining elements in the series.

TooManyListenersException Thrown when only one listener may be registered on a particular event listener source, and more than one such registration is attempted. APPENDIXD

The java.io Package

D.1 INTRODualON

( DaIIlnput

(:.:.j

( DaIIOulpui }..... \f--=-c--..,--J

FIG. D.1 The java.io package

437 438 Java and Object Orientation

The java.io package provides the basic input output facilities for the Java environment. Primarily this input output is built around the use of data streams. For example, to read data from a me, a stream is associated with that me and then the data in read from the stream. In general higher level streams build on lower level streams, thus a data input stream will build on a lower level input stream. The classes defined in this package are illustrated in Figure D.I and Figure D.2.

Oataln",,1 "\ r Objectinput J"V'IO ..J~

ObjectStroomcla' ~

nv-.bto exception - -- Java lang (java lang) t ---< IOExcepllOn f---1 ObjectStroamException , i InvaWdClaJ.lExcepbOn

Inv~ption NotActivoExceptlon ---< NotSonaliDbtoExcopllOn OptionaJOotaExceptlon J StroomComJptodExcop • WriloAbotIodExceptoon

FIG. D.2 The object related java.io classes and interfaces

D.2 THE CLASSES

BufferedInputStream, BufferedOutputStream An input or output stream that does not necessarily make calls to the underlying system for each byte. The data is read or written into a buffer and subsequent accesses use the data in the buffer.

BufferedReader, BufferedWriter Reads text from (or writes it to) a character stream, buffering characters so as to provide for efficient access to characters, arrays, and lines.

ByteArrayInputStream, ByteArrayOutputStream Allows an application to create an input (output) stream in which the bytes are supplied by the contents of a byte array. Appendix 0 439

CharArrayReader, CharArrayWri ter Instances provide a buffer that can be used as a character input (output) stream.

DatalnputStream, DataOutputStream Allows an application to read primitive Java data types from an underlying input (output) stream in a machine-independent way.

File Instances represent the name of a fIle or directory on the host fIle system. Methods allow various fIle manipulation operations (e.g. deleting or renaming the fIle, checking permissions and that the fIle exists, etc.).

FileDescriptor Instances serve as an opaque handle to the underlying machine-specific structure representing an open fIle or an open socket. Applications should not create their own fIle descriptors.

FilelnputStream, FileOutputStream An input (output) stream designed to read data from (write data to) a fIle.

FileReader, FileWri ter Convenience class for reading (writing) character fIles.

FilterlnputStream, Filter9utputStream Instances allow some fIltering of the data being read (written). These streams sit on top of an underlying input (output) stream.

FilterReader I FilterWriter Abstract class for reading (writing) fIltered character streams.

InputStream Abstract root class of all input streams.

InputStreamReader A bridge between byte streams and character streams. It reads bytes and translates them into characters according to a specified character encoding.

LineNumberReader A buffered character input stream that keeps track of line numbers (a line is terminated by anyone of a line feed, a carriage return, or a carriage return followed immediately by a linefeed).

Obj ectlnputStream Deserializes primitive data and objects previously written using an Obj ectOutputStream. 440 Java and Object Orientation

Obj ectOutputStream Serializes primitive data and objects to a fIle. The information can be restored using an ObjectlnputStream.

ObjectStreamClass Describes a class that can be serialized to a stream. It contains the name and the serialVersionUID of the class.

OutputStream The abstract root class of all output streams.

OutputStreamWriter Instances of this class convert characters to bytes and write them out to a more basic data stream.

pipedlnputStream, PipedOutputStream Instances provide the source of a communications pipe between two threads (a producer-consumer relationship).

PipedReader, PipedWri ter Provides a character-based pipe.

PrintStream An output stream fIlter that provides convenient methods for printing types other than bytes and arrays of bytes.

PrintWriter Instances print formatted representations of objects to a text output stream.

PushbacklnputStream An input stream filter that provides a one• byte buffer which allows an application to "unread" the last character that it read. The next time that a read is performed on the input stream fIlter, the "unread" character is re-read.

PushbackReader As for pushbacklnputStream, except that it is focused on characters rather than bytes.

RandomAccessFile An interface to a random access fIle.

Reader The abstract superclass for character readers.

SequencelnputStream Instances allow a number of streams to be joined together in sequence and treated as a single stream.

StreamTokenizer Allows a stream to be separated into tokens (delimited by a specific character such as space, period, etc.).

StringReader, StringWri ter Instances treat a string (as opposed to a fIle or other data source) as the source (sink) of the stream. Appendix 0 441

Wri ter The abstract superclass for character writers.

D.3 THE INTERFACES

DataInput I DataOutput Implemented by streams that can read (write) primitive Java data types from (to) a stream in a machine• independent manner.

Externalizable Allows a class to specify the methods to be used to write the object's contents to a stream and read them back.

FilenameFil ter Instances of classes that implement this interface filter filenames.

ObjectInput, ObjectOutput Extends the DataInput (DataOutput) interface to include reading (writing) objects.

ObjectInputValidation Callback interface that allows validation of objects within a graph (used in serialization).

serializable The protocol that enables an object to be serialized.

D.4 THE EXCEPTIONS

CharConversionException Root class for character conversion exceptions.

EOFException End of file.

FileNotFoundException The specified file does not exist.

IOException Root class of all 10 exceptions.

InterruptedIOException During either input or output an interrupt occurred.

InvalidClassException The serialization run time detects a problem with a class.

InvalidObj ectException A de serialized object cannot be made valid.

NotActi veException Serialization or deserialization is not active. 442 Java and Object Orientation

NotSerializableException The data being ~itten or read is not a serializable object.

Obj ectStreamException Root class of all object stream exceptions.

OptionalDataException There is primitive data in the stream and an object is expected. The length field of the exception indicates the number of bytes that are available in the current block.

StreamCorruptedException A stream header is invalid or control information in the stream is not found or is invalid.

SyncFailedException A synchronization process has failed.

UTFDataFormatException A malformed UTF-8 string has been read in a data input stream or by a class that implements the data input interface.

UnsupportedEncodingException The character encoding being used is not supported.

WriteAbortedException Thrown when reading a stream terminated by an exception that occurred while the stream was being written. APPENDIXE

The java.awt Package

E.1 INTRODualON

( PtIntG.. p/IIco )

)

Throwable , ... I0"G

FIG. E.1 The java.awt package

443 444 Java and Object Orientation

The java.awt package contains the majority of classes used to create graphical user interfaces (GUIs) and for drawing graphics and images (see Figure E.! and Figure E.2). There four other packages associated with the AWT are java.awt.event (see Appendix F), java.awt.image (see Appendix G), java.awt.datatransfer and java.awt.peer.

( LayoutManager )--{ LayoutManager2 A·.:: ..... ,.------, ... "",,::::..--. .. . ' BorderLayout=. ;:;/1.. ,

GridBagLayout .. / Clonable GridBagConstraints .. java.lang FIG. E.2The layout managers

E.2 THE CLASSES

AWTEvent The root class for all AWT events.

AWTEventMulticaster Implements efficient multi-cast event dispatching for AWT events.

BorderLayout A layout manager which can lay components out within a container at five different locations.

Button A button component.

Canvas A generic component whose subclasses provide the required functionality (Le. drawing some graphic components).

CardLayout A layout manager for a container that contains several "cards". Only one card is visible at a time, allowing you to flip through the cards.

Checkbox A graphical component which comprises a label, a toggle and a state.

CheckboxGroup An object which associates a set of check boxes in a radio button style relationship.

CheckboxMenultem A check box that represents a choice in a menu. AppendixE 445

Choice A button which presents a number of selections.

Color RGB colours (e.g. Color. red gives the RGB code for red).

Component A generic component which acts as the root of all graphic components (e.g. Button, Label, etc.).

Container Instances can hold one or more graphic components.

Cursor Encapsulates the bitmap representation of the mouse cursor (e.g. crosshair, arrow, hand, etc.).

Dialog Instances are simple windows that receive data from a user. They can be modal or non-modal.

Dimension Instances represent a particular dimension in 2-D (e.g. a width and a height).

Event A platform-independent class that encapsulates events from the local GUI platform.

EventQueue A platform-independent class that queues events, both from the underlying peer classes and from trusted application classes. There is only one event queue for the system.

FileDialog Defines a fIle selection dialog appropriate for the current platform, thus removing the need for the user to write a different dialog for each platform. It is a modal dialog.

FlowLayout Arranges components in rows from left to right.

Font Instances represent fonts.

FontMetrics Instances represent font metrics.

Frame A top level window with a title and zero or more components and containers.

Graphics An abstract class that represents a graphics context onto which graphic elements can be drawn. These elements are then rendered onto the displayed window.

GridBagConstraints Instances specify constraints for components laid out using the GridBagLayout manager. 446 Java and Object Orientation

GridBagLayout A flexible layout manager that aligns components vertically and horizontally, without requiring that the components be the same size. The actual layout is controlled by an associated GridBagConstraints instance.

GridLayout A layout manager that arranges components according to a 2-D grid (the size of which is determined when the manager is constructed). Components are placed in equal-sized locations within the grid.

Image An abstract class that is the root of platform-dependent classes used to represent a set of pixel values.

Insets Used to layout containers.

Label Used to construct textual labels for display within a window.

List Facilities for single (and multiple) selection lists.

MediaTracker Instances manage the loading of images (for example, in the background).

Menu Defines an object on a menu bar.

MenuBar A platform-dependent representation of a menu bar.

MenuComponent The abstract superclass of all components of a menu.

MenuItem An object which can be used as an option on a menu.

MenuShortcut Instances represent keyboard shortcuts for menu items.

Panel A generic container class for components and other containers.

Point Instances represent x and y coordinates in a 2-D space.

Pol ygon Instances represent a series of x and y locations.

PopupMenu A dynamically generated and displayed menu which can pop up at a specific point within a window.

PrintJob An abstract class which initiates and executes a print job. It provides access to a print graphics object which renders to an appropriate print device. AppendixE 447

Rectangle Instances represent a rectangle as an x and y point (top left hand corner), a width and a height.

ScrollPane Can be used with a canvas to provide a scrollable region

Scrollbar Allow a variable's value to be modified within a range.

SystemColor Encapsulates symbolic colours representing the colour of GUI objects on a system.

TextArea A direct subclass of TextComponent that provides a graphical component for displaying and editing multiple lines of text.

TextComponent A generic class that provides a component which allows editable text.

TextField Manages the display (and editing) of a single line of text.

Toolki t An AWT toolkit that binds the abstract AWT classes to a particular native toolkit implementation.

Window A top-level window with no borders and no menu bar. It could be used to implement a pop-up menu.

E.3 THE INTERFACES

Adjustable The protocol for classes which implement an numeric value contained within a bounded range of values.

ItemSelectable The protocol for objects which contain a set of items of which zero or more can be selected.

LayoutManager The protocol for classes that layout containers.

LayoutManager2 A protocol for classes that layout containers based on a layout constraints object. It extends the LayoutManager interface and is intended primarily for tool builders.

MenuContainer The protocol for classes that can contain menus.

PrintGraphics The protocol for classes that can print from a graphics context. 448 Java and Object Orientation

Shape The common protocol for objects that represent some form of geometric shape.

E.4 THE EXCEPTIONS

AWTException Indicates that an AWT exception has occurred.

IllegalComponentStateException An AWT component is not in an appropriate state for the requested operation.

E.S THE ERRORS

AWTError A fatal problem from which the AWT cannot recover. APPENDIXF

The java.awt.event Package

F.1 INTRODUCTION

This package defines the classes and interfaces which comprise the delegation event model (see Figure F.l).

r SeriaI~bI. ") ~

FIG. F.1 The java.awt.event package

449 450 Java and Object Orientation

F.2 THE CLASSES

ActionEvent Indicates that an action type event has occurred.

Adj ustmentEvent Indicates that an adjustment event has occurred.

ComponentAdapter The adapter which receives component events.

Component Event The root event class for all component-level events.

ContainerAdapter The adapter which receives container events.

ContainerEvent Indicates that a container event has occurred.

FocusAdapter The adapter which receives focus events.

FocusEvent The component-level focus event.

InputEvent Indicates that an input event has occurred.

ItemEvent Generated when an item is selected, deselected, expanded, or contracted.

KeyAdapter The adapter which receives keyboard events.

KeyEvent The component-level keyboard event.

MouseAdapter The adapter which receives mouse events.

MouseEvent Indicates that a mouse event, such as a button. being pressed or released, has occurred.

MouseMotionAdapter The adapter which receives mouse motion events.

PaintEvent The component-level paint event. This event is not designed to be used with the Event Listener model; programs should continue to override paint and update methods in order to render themselves properly.

TextEvent The text event emitted by a TextComponent.

WindowAdapter The adapter which receives window events.

WindowEvent The window-level event. Appendix F 451

F.3 THE INTERFACES

ActionListener The protocol for receiving action events.

AdjustmentListener The protocol for receiving adjustment events.

ComponentListener The protocol for receiving component events.

ContainerListener The protocol for receiving container events.

FocusListener The protocol for receiving focus events.

ItemListener The protocol for receiving item events.

KeyListener The protocol for receiving keyboard events.

MouseListener The protocol for receiving mouse events.

MouseMotionListener The protocol for receiving mouse motion events.

TextListener The protocol for receiving text events.

WindowListener The protocol for receiving window events. APPENDIXG

The java.awt.image Package

G.1 INTRODUCTION

OirectCoIorModel IndexCoIorModei ( Cionable ) java.lang CroplmageFi~er RGBlmageFH.er abstract

( ImageConsumer )

( ImageObserver ) FIG. G.1 The java.awt.image package This package defines classes and interfaces used to create, modify and manipulate images (see Figure G.l).

6.2 THE CLASSES

AreaAveragingScaleFil ter An ImageFil ter class for scaling images using a simple area averaging algorithm that produces smoother results than the nearest neighbour algorithm.

ColorModel An abstract class that encapsulates the methods for translating from pixel values to alphabetic red, green, and blue colour components for an image.

CroplmageFil ter An ImageFil ter class for cropping images

DirectColorModel A ColorModel class that specifies a translation from pixel values to alphabetic red, green, and blue colour

453 454 Java and Object Orientation

components for pixels which have the colour components embedded directly in the bits of the pixel.

Fil teredImageSource This class is an implementation of the ImageProducer interface. It takes an image and a fllter object and uses them to produce image data for a new flltered version of the original image.

ImageFil ter A fllter for the set of interface methods that are used to deliver data from an ImageProducer to an ImageConsumer.

IndexColorModel A ColorModel class that specifies a translation from pixel values to alphabetic red, green, and blue colour components which represent indices into a fixed colour map.

MemoryImageSource An implementation of the ImageProducer interface which uses an array to produce pixel values.

PixelGrabber An implementation of the ImageConsumer which can be attached to an Image or ImageProducer object to retrieve a subset of the pixels in that image.

RGBImageFil ter An abstract class that provides an easy way to create an lmageFil ter which modifies the pixels of an image in the default RGB ColorModel.

ReplicateScaleFilter An ImageFilter class for scaling images using the simplest algorithm.

G.3 THE INTERFACES

ImageConsumer The protocol for objects which express an interest in image data through an ImageProducer interface.

ImageObserver An asynchronous update interface for receiVIng notification of image information as an Image is constructed.

ImageProducer The protocol for objects that can produce the image data for an Image. APPENDIXH

Java Keywords

H.l KEYWORDS

There are 45 keywords and 3 literals (true, false and null) in Java:

abstract boolean break byte case catch char class continue default do double else extends false final finally float for if implements import instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try void volatile while Notice that goto and const are also reserved, but they currently have no meaning.

H.2 JAVA COMMENTS

There are three types of comment in Java: 1/ Single line comments. /* */ 'c' style comments (rarely used in Java). /** */ javadoc style comments (used to document classes, instance and class variables, and methods).

455 References

Alexander, C. et al. (1977). A Pattern Language. Oxford University Press. Alexander, C. (1979). The Timeless Way of Building. Oxford University Press. Arnold, K. and Gosling, J. (1996). The Java Programming Language. Addison-Wesley. ISBN 0-201-63455-4. Beck, K. and Johnson, R. (1994). "Patterns Generate Architectures", Proceedings of ECOOP'94, pp. 139-149. Ben-Natan, R. (1995). CORBA: A Guide to Common Object Request Broker Architecture. McGraw-Hill. ISBN 0-07-005427. Binder, Robert V. (ed.) (1994). Special Issue of Communications of the ACM, Object Oriented Software Testing 37(9). ACM Press. Binder, Robert V. (1994). "Design for Testability in Object-Oriented Systems", Special Issue of Communications of the ACM, Object Oriented Software Testing 37(9) pp. 87-101. Birrer, A. and Eggenschmiler, T. (1993). "Frameworks in the Financial Engineering Domain: An Experience Report", Proceedings ofECOOP'93, pp. 21-35. Boehm, B. W. (1988). "A spiral model of software development and enhancement", IEEE Computer, May 1988, pp. 61-72. Booch, G, Jacobson, I. and Rumbaugh, J. (1997). The Unified Modeling Language User Guide. Addison-Wesley. Booch, G, Jacobson, I. and Rumbaugh, J. (1996). The Unified Modeling Language for Object Oriented Development, Documentation Set, Version 0.91 Addendum, UML Update. Rational Software Corporation (available at http://www.rational.com/ot!uml.html). Booch, G. (1996). Object Solutions: Managing the Object-Oriented Project. Menlo Park: Addison-Wesley. ISBN 0-8053-0594-7. Booch, G. and Rumbaugh, J. (1995). The Unified Method Documentation Set, Version 0.8. Rational Software Corporation (available at http://www.rational.com/ot/uml.html). Booch, G. (1994). Object-Oriented Analysis and Design with Applications, 2nd edition. Redwood City, California: Benjamin Cummings. Booch, G. (1991). Object-Oriented Design with Applications. Benjamin Cummings. Booch, G. (1987). Software Components with Ada. Menlo Park, California: Benjamin Cummings. Booch, G. (1986). "Object Oriented Development", IEEE Transactions on Software Engineering, February, 12(2), pp. 211-221. Brooks, F. (1987). "No Silver Bullet: Essence and Accidents of Software Engineering", IEEE Computer, April. Brown, A. 1. (1989). Persistent Object Stores (Ph.D. thesis). University of St. Andrews.

457 458 Java and Object Orientation

Budd, T. (1991). An Introduction to Object Oriented Programming. Addison-Wesley. ISBN 0- 201-54709-0. Budinsky, F. J. et al. (1996). "Automatic code generation from design patterns", IBM Systems Journal 35(2). Buschmann, F. et al. (1996). Pattern-Oriented Software Architecture - A System of Patterns. Wiley and Sons Ltd. ISBN 0-471-95869-7. Chan, P. and Lee, R. (1996). The Java Class Libraries: An Annotated Reference. Addison• Wesley. ISBN 0-201-69581-2. Coad, P. and Yourdon, E. (1991). Object-Oriented Analysis. Englewood Cliffs, NJ: Yourdon Press. Coleman et al. (1994). Object Oriented Development: The Fusion Method. Prentice Hall International. ISBN 0-13-101040-9. Cook, S. and Daniels, J. (1994). Designing Object Oriented Systems: Object-oriented modelling with Syntropy. New York: Prentice Hall. ISBN 0-13-203860-9. Coplien, J. o. and Schmidt, D. C. (eds) (1995). Pattern Languages of Program Design. Addison -Wesley. ISBN 0-201-60734-4. Cornell, G. and Horstmann, C. S. (1997). Core JAVA, 2nd edition. Prentice Hall. ISBN 0-13- 596891-7. Cox, B. J. (1990). "There Is a Silver Bullet", BYTE, October, pp. 209-218. Cox, B. J. and Novobilski, A. (1991). Object-Oriented Programming: An Evolutionary Approach, 2nd edition. Addison-Wesley. ISBN 0-201-54834-8. Derr, K. W. (1995). Applying OMT: A Practical step-by-step guide to using the Object Modeling Technique. Prentice Hall. ISBN 0-13-231390-1. Englander, R. (1997). Developing JavaBeans. O'Reilly and Associates. ISBN 1-56592-289-l. Flanagan, D. (1996). Java in a Nutshell. O'Reilly and Associates. ISBN 1-56592-183-6. Fowler, M. (1997). Analysis Patterns: Reusable Object Models. Addison-Wesley. ISBN 0-201-89542-0. Fowler, M. and Scott, K. (1997). UML Distilled. Addison-Wesley. Freedman, R. S. (1991). "Testability of software components", IEEE Trans. Softw. Eng. 17(6), June, pp. 553-564. Gamma, E. et ai, (1995). Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley. Gamma, E. et al. (1993). "Design patterns: Abstraction and reuse of object-oriented design", ECOOP'93 (Lecture Notes in Computer Science 707), pp. 406-431. Springer-Verlag. Geary, D. M. and McClellan, A. L. (1997). Graphic Java. SunSoft Press. ISBN 0-13-565847-0. Goldberg, A. and Robson, D. (1983). Smalltalk-80: The Language and its Implementation. Addison-Wesley. Goldberg, A. and Robson, D. (1989). Smalltalk-80: The Language. Addison-Wesley. ISBN 0-201-13688-0. Goldberg, A. (1984). A. Goldberg, Smalltalk-80: The Interactive Programming Environment. Addison-Wesley. Gosling, J., Joy, B. and Steele, G. (1996). The Java Language Specification. Addison-Wesley. ISBN 0-201-63451-1. References 459

Gosling, J. and Yellin, F. (1996). The Java Application Programming Interface, Vol. 1: Core Packages. Addison-Wesley. ISBN 0-201-63453-8. Gosling, J. and Yellin, F. (1996). The Java Application Programming Interface, Vol. 2: Window Toolkit and Applets. Addison-Wesley. Harel, D. et al. (1987). "On the formal semantics of Statecharts", Proceedings of the 2nd IEEE Symposium on Logic in Computer Science, pp. 54-64. Harel, D. (1988). "On visual formalisms", Communications of the ACM 31(5), pp. 514-530. Harmon, P. and Taylor, D. (1993). Objects in Action: Commercial Applications of Object• Oriented Technologies. Massachusetts: Addison-Wesley. Hoffman, D. and Strooper, P. (1995). "The testgraph methodology: Automated testing of collection classes", Journal ofObject Oriented Programming 8(7), pp. 35-41. Hopkins, T. and Horan, B. (1995). Smalltalk: An Introduction to Application Development Using VisualWorks. Prentice Hall. ISBN 0-13-318387-4. Hunt, J. E. (1997). "Constructing Modular User Interfaces in Java", Java Report. Jacobson, I et al. (1992). Object-Oriented Software Engineering: A Use Case Driven Approach. Reading, MA: Addison-Wesley. ISBN 0-201-54435-0. Johnson, R. E. (1992). "Documenting Frameworks with Patterns", Proceedings of OOPSLA'92, SIGPLAN Notices 27(10), pp. 63-76. Kemerer, C. F. (1987). "An Empirical Validation of Software Cost Estimation Models", Communications of the ACM 30(5), May 1987, pp. 416-429. Kernighan, B. W. and Ritchie, D. M. (1988). The C Programming Language, 2nd edition. Englewood Cliffs, NJ: Prentice Hall. Krasner, G. E. and Pope, S. T. (1988). "A Cookbook for Using the Model-View Controller User Interface Paradigm in Smalltalk-80", JOOP 1(3), pp. 26-49. Kuhn, T. (1962). The Structure ofScientific Revolutions. The University of Chicago Press. Lalonde, W. and Pugh, J. (1991). "Subclassing 1= subtyping 1= Is-a", Journal of Object Oriented Programming, Janurary 1991, pp. 57-62. Lindholm, T. and Yellin, F. (1996). The Java Virtual Machine Specification. Addison-Wesley. Love, T. (1993). Object Lessons: Lessons Learned in Object-Oriented Development Projects. New York: SIGSBooks. Meyer, B. and Nerson, J. (1993). Object-Oriented Applications. New Jersey: Prentice Hall. Meyer, B. (1988). Object-Oriented Software Construction. Englewood Cliffs, NJ: Prentice Hall International. Moser, S. and Nierstrasz, O. (1996). "The Effect of Object-Oriented Frameworks on Developer Productivity", IEEE Computer, September 1996, pp 45-51. Myers, G. J. (1979). The Art of Software Testing, Business Data Processing: a Wiley Series. John Wiley and Sons. Orfali, R., Harkey, D. and Edwards, J. (1995). The Essential Distributed Objects Survival Guide. John Wiley & Sons. ISBN 0-471-12993-3. Ousterhout, J. K. (1994). TCL and the TK Toolkit, Professional Computing Series. Addison• Wesley. ISBN 0-201-63337-X. Parker, T. (1994). Teach yourself TCPflP in 14 Days. Indianapolis: Sams Publishing. ISBN 0-672-30549-6. 460 Java and Object Orientation

Perry, D. E. and Kaiser, G. E. (1990). "Adequate testing and object oriented programming", Journal of Object Oriented Programming 2(5), January 1990, pp. 13-19. Rational (1996). Unified Modeling Language for Real-Time Systems Design. Rational Software Corporation (available at http://www.rational.com/ot/uml.html). Rumbaugh, J. et al. (1991). Object-oriented modeling and design. Prentice Hall. Scharf, D. (1995). HTML Visual Quick Reference. Que Corporation. IN 0-7987-0411-0. Sevareid, J. (1997). "The JDK US New Delegation Event Model", Java Report, pp. 59-79. Smith, D. N. (1994). IBM Smalltalk: The Language. Benjamin Cummings. ISBN 0-8053-0908- X. Sparks, S., Benner, K. and Faris, C. (1996). "Managing Object-Oriented Framework Reuse", IEEE Computer, September 1996, pp. 52-61. Taylor, D. A. (1992). Object-Oriented Information Systems: Planning and Implementation. New York: John Wiley. van der Linden, P. (1996). Just JA VA. SunSoft Press, A Prentice Hall Title. ISBN 0-13-565839- X. Vlissides, J. M., Coplien, J. O. and Kerth, N. 1. (1996). Pattern Languages of Program Design 2. Addison-Wesley. ISBN 0-201-89527-7. Winston, P. H. and Narasimhan, S. (1996). On to JAVA. Addison-Wesley. ISBN 0-201-49826- X. Wirfs-Brock, R., Wilkerson, B. and Wiener, 1. (1990). Designing Object Oriented Software, Pub. Prentice Hall. ISBN 0-13-629825-7, (1990. Yourdon, E. (1994). Object-Oriented Systems Design. New Jersey: Prentice Hall. ECOOP'89, Third European Conference on Object-Oriented Programming, the British Computer Society Workshop series. Stephen Cook (ed.). Cambridge University Press. ISBN 0-521-38232-7. ECOOP'92, European Conference on Object-Oriented Programming, Lecture Notes in Computer Science series. O. Lehrmann Madsen (ed.). Springer-Verlag. ISBN 0-387- 55668-0. ECOOP'93, European Conference on Object Oriented Programming. Lecture Notes in Computer Science 707. Springer-Verlag. ECOOP'94, European Conference on Object Oriented Programming. Lecture Notes in Computer Science 821. Springer-Verlag. ECOOP'95, Ninth European Conference on Object-Oriented Programming. Lecture Notes in Computer Science 952. Springer-Verlag. ISO (1993). Information technology. software packages. quality requirements and testing. ISO Draft International Standard, ISO/IEC DIS 12119. OOPSLAIECOOP'90, Joint Conference on Object-Oriented Programming: Systems, Languages and Applications. Norman Meyrowitz (ed.). Addison-Wesley. ISBN 0-0201- S2430-X. OOPSLA'91. Conference on Object-Oriented Programming Systems, Languages and Applications, also as ACM SIG PLAN Notices 26(11). Andreas Paepcke (ed.). Addison• Wesley. ISBN 0-0201-55417 -8. References 461

OOPSLA'92. Seventh Annual Conference on Object-Oriented Programming Systems, Languages and Applications, also as ACM SIG PLAN Notices 27(10). Andreas Paepcke (ed.). Addison-Wesley. ISBN 0-201-53372-3. OOPSLA'93. Conference Proceedings, ACM SIG PLAN. Addison-Wesley. ISBN 0-201-58895 Index

A Ada programming language Booch method, 345 abs function, 89 abstract class encapsulation, 18 discussion, 21, 22, 114, 128 family links, 14 FixedCollection, 147 modular paradigm, 4 overloading, 23 Graphics, 219 size, 50 GrowableCollection, 145 addObserver method, 201 Reader, 175 ADT. See abstract data type SortedCollection, 149 Writer, 175 analysis tools, 418 abstract data type, 22 Anyware Office, 56 applet abstract keyword, 115 building, 292 definition, 55, 289 Choice class, 238 example, 293 Component class, 215 HTML tag, 295, 297 Container class, 216 description, 213, 227 running. 54 Dialog class, 238 security, 290, 407 FileDialog class, 238 signed, 290, 407 Frame class, 217, 222, 223 Applet class, 291-292 appletviewer tool, 54, 290, 294 Graphics class, 219 java.awt packages, 214 application graphical, 222, 246 List class, 238 GU!, 229, 249, 263 Menu class, 238 JavaDraw, 263 MenuBar class, 238 Organizer, 165-170 MenuItem class, 238 serialization, 191 Panel class, 217 simple, 35-46 PopupMenu class, 238 synchronization, 335 Scrollbar class, 238 Windscreen Wipe, 35-46 abstraction, 17,21 archiving Java, 54, 407 accessor method, 81, 102, 167,309 arithmetic operators, 88, 96 ActionListener interface, 231, 256 array active thread, 330 creating, 135 ActiveX, 408 464 Java and Object Orientation

initializing, 136 instance, 70, 110 length, 137 instance variable, 71 multidimensional, 139 naming, 83, 309 return syntax, 138 object and, 108 ASCII encoding system, 174 purpose, 108, 113,310 assignment statement, 91 reusability, 113 autoexec.bat file, 58 scope, 317 AWT. See Abstract Window Toolkit static initialization block, 75 syntax, 69 B URL,299 Beans Development Kit, 408 visibility, 119 Booch design method, 345 See also class, named Boolean, 95 class hierarchy border layout manager, 241, 247 inheritance, 16,29 BorderLayout object, 241 instantiation, 29 break statement, 318 method, 70 browser, 51, 55, 289 types, 29 Button class, 233 class method byte data type, 88 definition, 75 Math, 89 c ownership, 70 position, 316 C programming language, 4, 23, 79, 88, purpose, 109,315 155, 157, 158,305 class modifier, 119 C++ programming language, 21, 139, class variable 410 accessing, 309 card layout manager, 246 definition, 70, 74 CardLayout object, 246 initialization, 75, 308 ceil function, 89 multi-word name, 307 char data type, 89 naming, 83 Character class, 89 scope, 317 charAt string method, 90 semantic name, 306 Checkbox class, 234 typed name, 306 CheckboxGroup class, 235 class, named class Applet,291 abstract, 21, 22, 114 BufferedReader,180 comment, 100,311 BufferedWriter,180 creating, 99 Button, 233 data structure, 127 Character, 89 definition, 19,27 Checkbox, 234 example, 99 CheckboxGroup,235 file name, 99 Component, 212, 215, 231 inheritance, 21, 111 Container, 212, 216 inner, 77 Index 465

Dictionary, 128 priority, 330 Double, 87 thread, 330 Exception, 326 concurrent process. See thread FixedCollection, 143, 147 conditional operator, 157 Float, 87 console input, 185 Frame,212,217,222,223 constant, 83 Graphics, 219 constructor GrowableCollection, 143, 145 default, 75 Hashtable, 128 definition, 75 Integer, 87 naming, 83 Label,235 position, 316 Long, 87 purpose, 116, 316 Math,89 syntax, 75 Object, 112, 128 Container class, 212, 216 ObjectinputStream, 188, 190 continue statement, 318 ObjectOutputStream, 188, 189 control structure Observable, 200 conditional operator, 157 Panel, 217, 291 do loop, 161 Queue, 134 forioop, 160 Set, 146 if statement, 155 SortedCollection, 149 switch statement, 158 Stack,134 while loop, 161 Stream, 171 CORBA, 411, 418 String, 90 Corel Office, 56 TextArea, 237 TextComponent, 236 D TextField,237 data hiding. See encapsulation Thread, 331, 332 data structure, 143 ThreadGroup, 332 data type Throwable, 319 byte, 88 Vector, 130 char, 89 collaboration diagram, 367 double, 88 collection class, 143 float, 88 collections interface, 145 int, 70, 83, 87, 88 comment, 100,311 long, 88 Common Object Request Broker short, 88 Architecture. See CORBA database, object oriented, 413, 420 compareTo string method, 90 datatransfer package, 214 compiling Java, 54, 59 debugging Java, 54,60 Component class, 212, 215, 231 deleteObserver method, 201 component hierarchy, 213 dependants, 201 concurrency dependency mechanism description, 329 addObserver method, 201 466 Java and Object Orientation

changed methods, 203, 204 enumeration, 135 deleteObserver method, 201 encoding systems, 174 example, 202,206,252 equals numeric method, 89 notifyObservers method, 200-204 equals string method, 90 Observable class, 200 equalsIgnoreCase string method, 90 Observer interface, 205 escape characters, 168 setChanged method, 203, 204 event delegation model, 227, 229 update method, 203 event package, 214 deployment diagram, 373 example applications design methods applet, 293 Booch,345 dependency, 202,206,252 Fusion, 349 graphical, 222, 246 Objectory, 348 GUI, 229, 249, 263 OMT, 346, 375 JavaDraw, 263 000,345 Organizer, 165-170 Unified Modeling Language, 353 serialization, 191 diagrams simple, 35-46 collaboration, 367 time-slicing, 335 deployment, 373 Windscreen Wipe, 35-46 sequence, 366 exception state, 370 catching, 323 use case, 356 defining, 326 Dictionary class methods, 128 delegating, 181 do loop, 161 handling, 320 documenting Java code, 54, 64, 80, 334 IOexception, 322 doesNotUnderstand method, 72 raising, 319 Double class, 87 throwing, 322 double data type, 88 try-catch-finally construct, 323, doubleValue numeric method, 89 324,336,338 downloading Java applications, 56 Exception class, 326 downloading the JDK, 55 exception,object, 319 dynamic binding. See late binding exit method, 223, 230 dynamic model of OMT, 347 exp function, 89

E F encapsulation file access class modifier, 119 errors, 181 description, 16-18,82 filename, 178 method modifier, 120 reading, 182 package, 121 writing, 184 style, 310 FileReader class, 179 variable modifier, 120 FileWriter class, 180 enumerated type, 312 FileWriter constructor, 176 Index 467 final keyword, 113 HotSpot Virtual Machine, 418 finalize method, 76,140,316 HTML, 295, 297 FixedCollection class, 143, 147 HTTP,298 flexibility of code, 8 HyperText Markup Language. See HTML Float class, 87 HyperText Transfer Protocol. See HTTP float data type, 88 floor function, 89 flow layout manager, 239, 256 if statement, 155 FlowLayout object, 239 image package, 214 for loop, 160 IndexOf string method, 90 Frame class inheritance example, 217,264 defaults, 21 purpose, 212 definition, 16,29 setSize method, 222 description, 19 setVisible method, 222 example, 17,72 WindowListener interface, 223, 229 implementation, 71, 111 functional model ofOMT, 347 instantiation and, 20 Fusion design method, 349 multiple, 21, 29 restricting, 113 G inner class, 77 garbage collection, 140. inpuUoutput. See Stream class See also memory management instance. See also object getter method. See accessor method class and, 110 graphical application, 222, 246 creating. See instantiation Graphics class, 219 definition, 28 graphics context, 219 example, 21 grid bag layout manager, 243 instance method, 75, 316 grid layout manager, 242, 256 instance variable GridBagLayout object, 243 accessing, 102, 309 GridLayout object, 242 class-specific, 73 GrowableCollection class, 143, 145 definition, 28, 74 GUI application, 229, 249, 263 initializing, 308 name, 83,306,307 H part-of hierarchy, 30 Hashtable class purpose, 308 constructor, 129 scope, 317 enumeration, 135 updating, 102 importing, 129 visibility, 94 load factor, 129 instantiation methods,130 constructor, 116 HelloWorld program, 67 description, 20 HotJava browser, 51, 55 example, 74, 103 HotJava Views, 420, 423 int data type, 70, 83, 87, 88 468 Java and Object Orientation

Integer class, 87 jar, 54,407 interface java, 54,60, 140,406 ActionListener, 231 javac, 54,59 description, 71 javadoc, 54,64,80, 334 enumerated type, 312 javah,54,404,405 listeners, 231 javap,54 native code, 417 jdb,54,60 Observer, 200, 205,253 processor scheduler, 330 purpose, 116,312 Java Foundation Classes, 417 Serializable, 190 java tool, 54, 60,140,406 syntax, 83 Java Virtual Machine WindowListener, 223, 229, 253 description, 53 Internet Foundation Classes, 417 java tool, 54, 60,140,330,406 iteration memory management, 76 do loop, 161 using, 103 for loop, 160 Java Workshop environment, 55 while loop, 161 java.applet package, 294 java.awt package, 214 J java.awt.datatransfer package, 214 jar tool, 54, 407 java.awt.event package, 214 Java applications java.awt.image package, 214 Anyware Office, 56 java.awt.peer package, 214 Corel Office, 56 java.lang package, 128 HotJava,55 java.net package, 299 Java Workshop, 55 javac tool, 54, 59 Jeeves,56 JavaChips Jigsaw, 56 microJava, 421 URLs,56 picoJava, 421 Java Beans, 408 UltraJava, 421 Java code JavaDraw application, 263 comments section, 80 javadoc tool, 54, 64, 80, 334 local variable section, 81 javah tool, 404, 405 statements section, 81 javakey tool, 407 Java Database Connectivity API, 410 JavaOS, 420, 422 Java Development Kit JavaStation, 420, 421 availability, 12 jdb tool, 54, 60 compiler speed, 12 JDBC. See Java Database Connectivity description, 54 API environment, 58 JDK. See Java Development Kit interpreter speed, 12 Jeeves Web server, 56 Web site, 55 Jigsaw Web server, 56 Java Development Kit tools JIT. See Just-In-Time appletviewer, 54, 290, 294 Just-In-Time compiler, 418 Index 469 join method, 335 mathematical operations, 89 max function, 89 K Media APIs, 417 keyword memory management, 76,140-141 abstract class, 115 message class modifier, 119 definition, 29, 68 final, 113 passing mechanism, 69 method modifier, 120 receiver, 68 native, 404 sender, 82 protected, 76 sending, 95 public, 119 meta-model, 108,354 static, 108 method synchronized, 334 accessor, 81, 309 variable modifier, 120 class-specific, 73 creating, 100 L definition, 28, 68 doesNotUnderstand,72 Label class, 235 exit, 223, 230 late binding, 8, 23, 69, 124 locating, 70 layout manager invoking, 95 border, 241, 247 join, 335 card, 246 main, 117, 168 Container class, 217 modifier, 120 flow, 239 naming, 83, 313 grid, 242 ownership, 70 grid bag, 243 position, 316 Panel class, 217 scope, 317 listener interfaces, 231 selecting, 125 listener object, 229 setSize, 222 Live Connect, 408 setVisible, 222 Live Object, 408 syntax, 79 load factor, 129 visibility, 120 local variable, 81 min function, 89 Long class, 87 models ofUML, 355 long data type, 88 Model-View-Controller architecture, loop 228,250,265 do, 161 modifier, 76, 317 for, 160 modularity, 7. See also reusability while, 161 mouse buttons, 269 MVC. See Model-View-Controller M architecture main method, 117, 168 mark and sweep, 140 Math class, 89 470 Java and Object Orientation

N naming convention, 83, 306, 313 OMT. See Object Modeling Technique native code OOA approach, 344 compiler, 406 OOD method, 345 interface, 417 object oriented languages, 14-15 linking, 404 object oriented system, 15 , 420 ObjectInputStream class, 188, 190 network computer, 420 ObjectOutputStream class, 188, 189 notifyObservers method, 203, 204 Observable class, 200 Null value, 94 Observer interface, 200, 205, 253 numbers, in Java, 88 ORB. See Object Request Broker numeric methods, 89 Organizer application, 165-170 overloading operators, 23 o overriding operators, 23 object p BorderLayout,241 CardLayout, 246 package class, comparison with, 108 accessing elements, 123 concurrency, 329 example, 122 definition in Java, 50 explicit, 121 dependency mechanism, 199 java.applet, 294 exception, 319 java.awt,214 FlowLayout, 239 java.awt.datatransfer, 214 GridBagLayout, 243 java.awt.event,214 GridLayout, 242 java.awt.image,214 listener, 229 java.awt.peer,214 Runtime, 141 java.lang, 128 saving to a file, 187 java.net, 299 serial number, 187, 195 name, 121 serialization, 187 UML,365 window, 211 packaging code, 8 Object class, 112, 128, 143 Panel class, 217, 255, 264, 291 Object Management Group, 374, 411, paradigm, programming, 4 420 parameters, 95 object model, 346, 357, 359, 360 part-of hierarchy, 165 Object Modeling Technique, 346-348, peer package, 214 375,393,399 Performance Runtime for Windows, 418 Object Oriented Analysis, 344 persistent data, 187 Object Oriented Development method, placeholder class. See abstract class 345 pointer manipulation, 139 Object Request Broker, 412 polymorphism, 9,17,22-23,69,124 Objectory design method, 348-349 portability, 50, 53, 88 OLE, 417 pow function, 89 Index 471 precedence of operators, 96 running applets, 54 preemptive scheduler, 335 running Java. See Java Virtual Machine PrintWriter class, 181, 184 Runtime environment object, 141 process. See thread process priority, 330 5 processor scheduler, 330 saving object information, 187 programming language scheduler, 335 Ada. See Ada programming scope of methods and variables, 317 language ScrollPane class, 266 C. See C programming language security, 406 c++. See c++ programming Security API, 407 language semaphore, 334 Eiffel, 12, 15,21 sender of message, 68, 82 Lisp, 4, 130 sequence diagram, 366 JavaScript, 55 serial number, 187, 195 Self, 15 Serializable interface, 191 Simula,14 serialization, 187, 191 Smalltalk. See Small talk Set class, 146 programming language setChanged method, 203, 204 protected keyword, 76 setSize method, 222 pseudo variable setter method. See updater method super, 93 setVisible method, 222 this, 29, 93 short data type, 88 public keyword, 119 signed applet, 407 sink of data. See Stream class Q Smalltalk programming language QAC analysis tool, 418 abstraction, 22 Queue class, 134 class, 108 collections, 130, 143 R dependency, 199 random function, 89 encapsulation, 18 reading a file, 182 history, 15 receiver of message, 68, 95 inefficiency, 11 recursion, 163 inheritance, 21 Reflection API, 403-404 maintenance, 13 Remote Method Invocation API, 409 Model-View-Controller Remote Object Registry, 410 architecture, 228 return array syntax, 138 performance, 12 return operator, 82,102 SortedCollection class, 149 reuseability, 68, 408 source of data. See Stream class RMI. See Remote Method Invocation special characters, 168 API SQL,410 round function, 89 sqrt function, 89 472 Java and Object Orientation

Stack class, 134 synchronized keyword, 334 statecharts, 347, 370 System object, 185, 223, 230 statement break,318 T continue, 318 template. See class label,318 temporary variable state diagram, 370 declaring, 308 static initialization block, 75, 315, 316 name,306 static method. See class method scope, 92 static modifier keyword, 108 visibility, 94 Stream class terminology definition, 171 class, 27, 69 encoding systems, 174 compared with procedural, 10 File, 178 inheritance, 29, 71 FileInputStream, 172 instance, 28, 69, 70 FileReader,l77 instance variable, 28, 71 FileWriter, 176 interface, 71 inpuUoutput,l77 message, 29, 68 InputStream, 172, 186 method, 28, 68 OutputStream, 172 receiver, 68 PrintWriter, 181, 184 sender, 68 Reader, 174, 175 subclass, 27, 71 StreamTokenizer, 176, 180 superclass, 28, 71 Writer, 174, 175 super pseudo variable, 93 StreamTokenizer class, 176, 180 this pseudo variable, 29 String class, 68, 90 test harness. See main method string methods, 90 TextArea class, 237 subclass. See also class TextComponent class, 236 definition, 27 TextField class, 237 example, 17,20 this pseudo variable, 29 extends hierarchy, 30 thread inheritance, 71 creating, 331 purpose, 111, 113,310 definition, 330 responsibility,22 group, 332 restricting a, 113 run method, 331, 333 substring method, 90 state, 330 superclass synchronization, 334 abstract, 113 Thread class, 331, 332 definition, 28 ThreadGroup class, 332 inheritance, 71 Throwable class, 319 super pseudo variable, 93 throws Throwable element, 76 switch statement, 158 toBinaryString method, 89 synchronization, 334, 335 toHexString method, 89 Index 473 tokens, parsing, 176 modifier, 120 toLowerCase method, 90 name, 306, 307 toOctalString method, 89 purpose, 308 toUpperCase method, 90 scope, 92, 94, 317 try-catch-finally construct, 323, 324, temporary, 306 336,338 visibility, 94, 120 Vector class u constructor, 130 UML. See Unified Modeling Language enumeration, 135 Unicode encoding system, 174 GrowableCollection,143 Unified Modeling Language length, 137 collaboration diagram, 367 management protocol, 133 deploytnentdiagram,373 methods, 131-132 description, 351, 353 storage, 132 meta-model, 354 visibility keyword, 80 models, 355 object model, 357 w package, 365 Web. See Worldwide Web sequence diagram, 366 Web server state diagram, 370 Jeeves,56 use case diagram, 356 Jigsaw, 56 Uniform Resource Locator. See URL while loop, 161 URL class, 298-299 widget. See Component class update method, 203 window object updater method, 102, 166,309 Component class, 212, 215, 231 user input, 185 Container class, 212, 216 use case, 356, 376 Frame class, 212, 217, 222, 223 Graphics class, 219 v Panel class, 217 valueOf method, 89 WindowListener interface, 223, 229, 253 variable Windscreen Wipe application, 35-46 accessing, 309 Worldwide Web, SO, 419 assignment statement, 91 writing a file, 184 data type, 91 y declaring, 308 initializing, 308 Yo-Yo problem, 73