November 2005
Intermediate to advanced
304 pages
6h 14m
English
As we discussed in the previous section, Java 5 added a nanoTime method to the System class to ensure that time measurements can keep up with faster systems. Even in earlier versions of Java, threads can have sleep times of less than a millisecond. You might recall that Java's threading mechanism has a sleep method
that takes an int parameter representing the sleep time in milliseconds. There is also a sleep method that accepts the millisecond parameter, plus an additional time in nanoseconds. If you set the millisecond time to 0, then the thread will sleep for the specified number of ...
Read now
Unlock full access