Saturday, 17 November 2012

TimeUnit class

If you want your java program to wait for defined time amount use class TimeUnit. It is more clean than using Thread.sleep.
Examples:
TimeUnit.NANOSECONDS.sleep(10)
TimeUnit.SECONDS.sleep(10)

No comments: