[Chapter 4] What's New in Java 1.1
Author: David Flanagan
Date: Thu Jul 31 15:51:01 1997

#

| Chapter 4 |

# 4. What's New in Java 1.1

Contents:
Select a new section and then

Java 1.1 is a huge new release. The number of packages in the API has increased from 8 in Java 1.0 to 23 in Java 1.1, and the number of classes has more than doubled from 211 to 503. On top of these changes to the core Java class libraries, there have been some important changes to the language itself. Also, the JDK--the Java Development Kit from Sun--includes a number of new tools in version 1.1.

The new features of Java 1.1 include:

Inner classes

  Changes to the Java language itself to allow classes to be nested within each other, and within blocks of code.

Java Beans

  A framework for defining reusable modular software components.

Internationalization

  A variety of new features that make it possible to write programs that run around the globe.

New event model

  A new model for handling events in graphical user interfaces that should make it easier to create those interfaces.

Other new AWT features

  The Java 1.1 AWT includes support for printing, cut-and-paste, popup menus, menu shortcuts, and focus traversal. It has improved support for colors, fonts, cursors, scrolling, image manipulation, and clipping.

Applets

  JAR files allow all of an applet's files to be grouped into a single archive. Digital signatures allow trusted applets to run with fewer security restrictions. The HTML `<APPLET>` tag has new features.

Object serialization

  Objects can now be easily "serialized" and sent over the network or written to disk for persistent storage.

Reflection

  Java programs can now "reflect" upon themselves or upon an arbitrary class to determine the methods and fields defined by the class, the arguments passed to a method, and so on. The Reflection API also allows the invocation of methods specified by name.

Security

  Java 1.1 includes a new package that supports digital signatures, message digests, key management, and access control lists.

Java Database Connectivity (JDBC)

  A new package that allows Java programs to send SQL queries to database servers. It includes a "bridge" that allows it to inter-operate with existing ODBC database servers.

Remote Method Invocation (RMI)

  An interface that supports distributed Java applications in which a program running on one computer can invoke methods of Java objects that exist on a different computer.

These and other new features are summarized in the sections below. Many of them are also described in more detail elsewhere in this book.

## 4.1 Java 1.1 Package-by-Package

The packages and classes of the Java class library are interlinked and interdependent. Many of the major new features of Java 1.1 rely on classes from multiple packages in the Java API. Before we examine those new features in detail, therefore, we need to understand the big picture of Java 1.1. The paragraphs below discuss each of the 23 packages that constitute the core API for Java 1.1; they introduce the new packages and explain the changes to existing packages.

`java.applet`

  Despite the introduction of JAR files, digitally signed applets, and new attributes of the `<APPLET>` tag, the `java.applet` package has not changed in any significant way.

`java.awt`

  The `java.awt` package contains new classes and interfaces to support printing, popup menus, and menu shortcuts, and to improve support for layout management, cursors, scrolling, colors, and clipping. Several classes provide support for the new AWT event model, but most event support is contained in one of several new sub-packages of `java.awt`.

`java.awt.datatransfer`

  The classes and interfaces in this package define a generic framework for inter-application (and intra-application) data transfer. This package also includes classes to support a clipboard-based cut-and-paste data transfer model. In the future, this package may be extended to include support for data transfer through a drag-and-drop metaphor. One of the two underlying data transfer mechanisms supported by this package relies on the Object Serialization API of the `java.io` package.

`java.awt.event`

  This package defines the classes and interfaces of the new AWT event handling model. The classes and interfaces of this package fall into three categories:

  - Event classes--the classes that actually represent events.

  - Event "listeners"--interfaces that define methods that must be implemented by objects interested in being notified when an event of a particular type occurs.

  - Event "adaptors"--trivial no-op implementations of the event listener interfaces that are suitable for easy subclassing.

  All the events and event listeners defined in this package extend the `EventObject` class or the `EventListener` interface defined in `java.util`.

`java.awt.image`

  This package has two new image filter classes that implement improved image scaling. Changes have also been made to the `MemoryImageSource` and `PixelGrabber` classes.

`java.awt.peer`

  The changes to this package for the most part simply reflect changes to `java.awt`. There are new interfaces that represent a platform-dependent popup menu and scrolling area, for example.

`java.beans`

  This package constitutes the much-touted JavaBeans API for creating and using embeddable, reusable software components. The classes and interfaces in this package can be used at three different levels:

  - To create application builder tools that programmers (or even non-programmers) can use to compose applications out of individual Java beans.

  - To develop Java beans for use in such application builders.

  - To develop applications (without using a builder tool) that use Java beans.

  Most of the classes and interfaces of the package are for use by application builders or by developers of advanced beans. Programmers using beans or writing simple beans do not need to be familiar with most of the package.

  Application builders that manipulate beans rely on the Reflection API defined in `java.lang.reflect`, and many beans take advantage of the Object Serialization API defined in the `java.io` package. The JavaBeans API uses the same event model that the Java 1.1 AWT does, and event-related classes and interfaces in this package are extensions of a class and an interface defined in `java.util`.

`java.io`

  The `java.io` package has become by far the largest of the core Java packages. This is because Java 1.1 adds:

  - A complete suite of new "character stream" classes to complement most of the existing "byte stream" input and output classes. These new "reader" and "writer" streams offer improved efficiency and support internationalization for textual input and output.

  - New classes and interfaces to support object serialization.

  - A number of new `IOException` types.

`java.lang`

  This package has several new `Exception` and `Error` types, as well as new `Byte`, `Short`, and `Void` classes. With the addition of these new classes, all primitive Java data types (including the `void` type) have corresponding object types. This is important for the `java.lang.reflect` package, which defines the new Reflection API. In addition, the `Class` class has been greatly enhanced for use with the Reflection API. `Class` and `ClassLoader` have methods to locate "resources" associated with a class, such as images, audio files, `Properties` files, and so on. Resources are important for internationalization in Java 1.1.

`java.lang.reflect`

  This new package enables a Java program to examine the structure of Java classes and to "reflect upon" its own structure. `java.lang.reflect` contains classes that represent the fields, methods, and constructors of a class, and enable a program to obtain complete information about any object, array, method, constructor, or field. The `java.beans` package relies heavily upon this package.

`java.math`

  This new package contains only two classes, which support arithmetic on arbitrary-size integers and arbitrary-precision floating-point numbers. The `BigInteger` class also defines methods for modular arithmetic, primality testing, and other features required for cryptography.

`java.net`

  The changes to the `java.net` package are quite low-level. They include the addition of multicast sockets, Unix-style socket options, and new exception types that provide finer granularity when handling networking exceptions.

`java.rmi`

  This package defines the fundamental classes and interfaces used for Remote Method Invocation. Most of the classes in this package are exception types. Subpackages of `java.rmi` provide additional, more specialized functionality. When objects must be passed as arguments to remote methods, RMI relies on the object serialization functionality provided in the `java.io` package.

`java.rmi.dgc`

  This small package defines the classes and interfaces required for distributed garbage collection (DGC).

`java.rmi.registry`

  This is another small package that defines the classes and interfaces required for a Java client to look up a remote object by name or for a Java server to advertise the service it provides.

`java.rmi.server`

  This package is the largest of the RMI packages and is at the heart of Remote Method Invocation. It defines the classes and interface that allow a Java program to create an object that can be used remotely by other Java programs.

`java.security`

  This package contains the classes and interfaces that represent the fundamental abstractions of cryptographic security: public and private keys, certificates, message digests, and digital signatures. This package does not provide implementations of these abstractions; by design, the Java Security API is implementation independent. Java 1.1 does include a default implementation, but vendor-specific implementations may also be used in conjunction with this package. The default security implementation relies on the `BigInteger` class defined in the `java.math` package.

`java.security.acl`

  This package defines high-level interfaces, and some exceptions, for manipulating access control lists.

`java.security.interfaces`

  This package defines a few interfaces that are required for the Java Security API's implementation-independent design.

`java.sql`

  This package is the Java Database Connectivity (JDBC) API. The classes and interfaces it contains allow Java programs to send SQL queries to databases and retrieve the results of those queries.

`java.text`

  The classes and interfaces in this package are used for internationalization. The package includes classes for formatting dates, times, numbers, and textual messages in a manner appropriate for the default locale, or for any specified locale. It also includes classes for collating strings according to the rules of a given locale and iterating through the characters, words, and sentences of a string in a locale-specific manner.

`java.util`

  As its name indicates, the `java.util` package contains miscellaneous utility classes. In Java 1.1, new classes have been added to this package to support the AWT and Java Beans event model, to define "locales" and "resource bundles" used for internationalization, and to manipulate dates, times, and time zones.

`java.util.zip`

  This package implements classes for computing checksums on streams of data, and for compressing and archiving (and uncompressing and unarchiving) streams of data, using ZLIB compression library and ZIP and GZIP file formats.

Summary |  | Inner Classes