How do I monitor times using a StopWatch?
Author: Deron Eriksson
Description: This Java tutorial describes how to use a StopWatch to perform timing activities.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 2.0 (Eclipse 3.3.0)


Page: < 1 2

(Continued from page 1)

The console output from StopWatchTest is shown here:

Results

STARTING STOPWATCH
1 second goes by
SUSPENDING STOPWATCH
Stopwatch time: 0:00:01.000
1 second goes by
Stopwatch time: 0:00:01.000 (doesn't change since suspended)
RESUMING STOPWATCH
1 second goes by
Stopwatch time: 0:00:02.000
SPLITTING STOPWATCH
1 second goes by
Stopwatch split time: 0:00:02.000 (reported time doesn't change but stopwatch still running)
Stopwatch time: 0:00:03.000
1 second goes by
Stopwatch split time: 0:00:02.000 (reported time doesn't change but stopwatch still running)
Stopwatch time: 0:00:04.000
UNSPLITTING STOPWATCH (removes split effect)
1 second goes by
STOPPING STOPWATCH
Stopwatch time: 0:00:05.000
RESETTING STOPWATCH
Stopwatch time: 0:00:00.000

Page: < 1 2