public class StopWatch
extends java.lang.Object
Class for timing applications. Provides a simple interface for the basic functionality of a stop watch and printing the results.
Constructor and Description |
---|
StopWatch()
Basic constructor for getting an instance of a StopWatch.
|
Modifier and Type | Method and Description |
---|---|
void |
lap()
Saves a lap time if the watch is running.
|
void |
print()
Prints out the lap times and the total time.
|
void |
printLap()
Prints out the lap time of the last recorded lap.
|
void |
start()
Starts the stop watch, saves the start time and clears old times.
|
void |
stop()
Stops the watch and saves the end time.
|
public StopWatch()
Basic constructor for getting an instance of a StopWatch.
public void start()
Starts the stop watch, saves the start time and clears old times.
public void stop()
Stops the watch and saves the end time.
public void lap()
Saves a lap time if the watch is running.
public void print()
Prints out the lap times and the total time.
public void printLap()
Prints out the lap time of the last recorded lap.