mirror of
https://bitbucket.org/Mattrixwv/javaclasses.git
synced 2025-12-06 15:03:58 -05:00
Added ability for Stopwatch to be treated as a
string for printing results
This commit is contained in:
@@ -134,4 +134,9 @@ public class Stopwatch{
|
||||
//Return the string
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return getStr();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class testStopwatch{
|
||||
|
||||
//Print the results
|
||||
System.out.printf("The timer results in: %s\n", timer.getStr());
|
||||
System.out.printf("The timer results in: " + timer + "\n");
|
||||
System.out.printf("The timer results in: %f milliseconds\n", timer.getMilli());
|
||||
|
||||
if(!failed){
|
||||
|
||||
Reference in New Issue
Block a user