### Java 2 Interactive Programmer's Workbook

## Source code for Chapter 04

Here is the source code to the exercises and examples for Chapter 04. When possible, we have linked to the corresponding applet as well. You will need to make sure that the Java 2 plug-in is installed on your browser.

Suggestion: Bring up the source code in a separate browser window so you can see the source code and the applet at the same time. To bring up a page in a new window, right-click on the link and select "View link in new window." If you have a three-button mouse, you can middle-click to do the same thing.

#### ComparisonOperatorsExample.java

- Source code for ComparisonOperatorsExample.java.
- See ComparisonOperatorsExample program output results.

#### EqualsExample1.java

- Source code for EqualsExample1.java.
- See EqualsExample1 program output results.

#### EqualsExample2.java

- Source code for EqualsExample2.java.
- See EqualsExample2 program output results.

#### EqualsMethodExample.java

- Source code for EqualsMethodExample.java.
- See EqualsMethodExample program output results.

#### EqualsVersusEqualsMethodExample.java

- Source code for EqualsVersusEqualsMethodExample.java.
- See EqualsVersusEqualsMethodExample program output results.

#### ForLoopColorsExample1.java

- Source code for ForLoopColorsExample1.java.
- See ForLoopColorsExample1 program output results.

#### ForLoopColorsExample2.java

- Source code for ForLoopColorsExample2.java.
- See ForLoopColorsExample2 program output results.

#### ForLoopColorsExample3.java

- Source code for ForLoopColorsExample3.java.
- See ForLoopColorsExample3 program output results.

#### ForLoopExample1.java

- Source code for ForLoopExample1.java.
- See ForLoopExample1 program output results.

#### ForLoopExample2.java

- Source code for ForLoopExample2.java.
- See ForLoopExample2 program output results.

#### GreaterThanExample.java

- Source code for GreaterThanExample.java.
- See GreaterThanExample program output results.

#### GreaterThanPriceExample.java

- Source code for GreaterThanPriceExample.java.
- See GreaterThanPriceExample program output results.

#### InvalidValueExample1.java

- Source code for InvalidValueExample1.java.
- See InvalidValueExample1 program output results.

#### InvalidValueExample2.java

- Source code for InvalidValueExample2.java.
- See InvalidValueExample2 program output results.

#### LessThanExample.java

- Source code for LessThanExample.java.
- See LessThanExample program output results.

#### LessThanTooShortExample.java

- Source code for LessThanTooShortExample.java.
- See LessThanTooShortExample program output results.

#### PasswordExample.java

- Source code for PasswordExample.java.
- See PasswordExample program output results.

#### SimpleBooleanExample.java

- Source code for SimpleBooleanExample.java.
- SimpleBooleanExample is not a runnable program with output.

#### SquaresForLoopExample.java

- Source code for SquaresForLoopExample.java.
- See SquaresForLoopExample program output results.

#### SquaresWhileExample.java

- Source code for SquaresWhileExample.java.
- See SquaresWhileExample program output results.

#### StringEqualsExample.java

- Source code for StringEqualsExample.java.
- See StringEqualsExample program output results.

#### SwitchDialPhoneExample.java

- Source code for SwitchDialPhoneExample.java.
- See SwitchDialPhoneExample program output results.

#### SwitchExample1.java

- Source code for SwitchExample1.java.
- See SwitchExample1 program output results.

#### SwitchExample2.java

- Source code for SwitchExample2.java.
- See SwitchExample2 program output results.

#### SwitchExample3.java

- Source code for SwitchExample3.java.
- See SwitchExample3 program output results.

#### SwitchExample4.java

- Source code for SwitchExample4.java.
- See SwitchExample4 program output results.

#### TemperatureExample1.java

- Source code for TemperatureExample1.java.
- See TemperatureExample1 program output results.

#### TemperatureExample2.java

- Source code for TemperatureExample2.java.
- See TemperatureExample2 program output results.

#### TemperatureExample3.java

- Source code for TemperatureExample3.java.
- See TemperatureExample3 program output results.

#### TemperatureExample4.java

- Source code for TemperatureExample4.java.
- See TemperatureExample4 program output results.

#### TemperatureExample5.java

- Source code for TemperatureExample5.java.
- See TemperatureExample5 program output results.

#### WhileGreaterThanExample.java

- Source code for WhileGreaterThanExample.java.
- WhileGreaterThanExample is not a runnable program with output.

#### WhileVectorExample.java

- Source code for WhileVectorExample.java.
- See WhileVectorExample program output results.

Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR