Java Reference
In-Depth Information
They connect to a computer's serial port.
n
They send and receive information.
n
They dial phone numbers.
n
1
The Modem class serves as an abstract model for the concept of a modem. To actually
have something concrete you can manipulate in a program, you must use the Modem class
to create a Modem object. The process of creating an object from a class is called instanti-
ation , which is why objects also are called instances.
A Modem class can be used to create many different Modem objects in a program, and each
of these objects could have different features, such as the following:
Some are internal modems and others are external modems.
n
Some use the COM1 port and others use the COM2 port.
n
Some have error control, and others don't.
n
Even with these differences, two Modem objects still have enough in common to be recog-
nizable as related objects. Figure 1.1 shows a Modem class and several objects created
from that template.
FIGURE 1.1
The Modem class
and several Modem
objects.
Internal Modem
Uses COM1
Supports error-control
(Concrete)
External Modem
Uses COM1
Supports error-control
(Concrete)
Modem Class
(Abstract)
External Modem
Uses COM2
No error-control
(Concrete)
Here's another example: Using Java, you could create a class to represent all command
buttons—clickable boxes that appear on windows, dialog boxes, and other parts of a pro-
gram's graphical user interface.
Search WWH ::




Custom Search