Java Reference
In-Depth Information
The following steps open the PasswordDemo program from the Data Disk
and then compile and execute the program.
To Open, Compile, and Execute the PasswordDemo Program
OTHER WAYS
1. With your Data Disk in drive A, click the Open button on the Standard
toolbar. If necessary, click the Look in box arrow and then select the
Chapter09 folder on the Data Disk in drive A.
The Open File(s) dialog box displays the files in the Chapter09 folder. If you
do not see any files, or you do not see any Java source files, verify that the
Files of type list box displays All Files (*.*).
2. Click the file, PasswordDemo.java, and then click the Open button.
3. Click Compile Java on the Tools menu.
4. Click Run Java Application on the Tools menu.
1. To compile, press
CTRL + 1
2. To compile at
command prompt,
type javac
PasswordDemo
.java
3. To run, press CTRL + 2
4. To run at command
prompt, type java
PasswordDemo
New passwords are created by typing an appropriate value in the New
Password text box and then clicking the Add password button. To enter a current
password and validate it against the current Password object (for example, to log
into an application), type the password in the Current Password text box and
then click the Use password button. To change the value of the current password,
type a new password in the New Password text box and then click the Change
password button. To test the Password class sufficiently, both valid and invalid
actions should be tested, such as adding passwords without a numeric character,
shorter than six characters, or longer than fifteen characters. After adding a pass-
word successfully, you should try to use the password, change the password, and
use a different password.
Print the Source Code
After testing the Password class, both the Password class source code and the
test program, PasswordDemo, source code should be printed. The following
steps print the source code for both programs.
To Print the Source Code
1. Click the Print button on the TextPad Standard toolbar.
The PasswordDemo source code is printed.
2. Click Password.java in the Selector Window to display the Password class
source code.
The Password class source code is displayed in the coding window.
3. Click the Print button on the TextPad Standard toolbar.
The Password source code is printed.
OTHER WAYS
1. Press CTRL + P
2. Press ALT + F , P
Search WWH ::




Custom Search