Java Reference
In-Depth Information
Starting a New Java Program in TextPad
The following steps start TextPad and save the TextPad document using a
Java file type.
To Start a New Java Program in TextPad
1. Insert the Data Disk in drive A.
2. Copy the Password.java file from the location where you saved it in the
previous chapter (the Chapter09 folder or the location specified by your
instructor) and paste the file in the Chapter10 folder or a location
specified by your instructor.
3. Start TextPad. If necessary, click Line Numbers on the View menu to
display line numbers.
4. Click File on the menu bar and then click Save As on the File menu.
When the Save As dialog box is displayed, click the Save in box arrow
and then click 3 1 / 2 Floppy (A:) in the Save in list.
5. Double-click the Chapter10 folder or a location specified by your
instructor.
6. Type PasswordException in the File name text box and then click Java
(*.java) in the Save as type list. Click the Save button in the Save As
dialog box.
The file named, PasswordException, is saved as a Java source code file in the
Chapter10 folder on the Data Disk in drive A (Figure 10-5).
FIGURE 10-5
file saved as
PasswordException.java
Creating Related Classes Using Inheritance
The requirements document in Figure 10-2 on page 607 and the inheritance
hierarchy in Figure 10-3 on page 609 describe the relative relationships between
the parent class, PasswordException, and the child classes. For the program to be
able to distinguish between the various child classes, each must have its own
type; however, for the program to refer to an object of any of the child classes
using a common type, each must have a common parent, which means they all
must inherit from the PasswordException class.
 
Search WWH ::




Custom Search