How to convert a value from nanoseconds to seconds?
Here's the code segment:
import java.io.*;
import java.util.concurrent.*;
..
class Stamper {
public static void main (String[] args) {
long start = System.nanoTime();
//some try with nested loops
long end = System.nanoTime();
long elapsedTime = end - start;
System.out.println("elapsed: " + elapsedTime + "nano seconds
");
//convert to seconds
TimeUnit seconds = new TimeUnit();
System.out.println("which is " + seconds.toSeconds(elapsedTime) + " seconds");
}}
The error is
Stamper.java:16: enum types may not be instantiated.
What does this mean?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…