How frustrating... I get to the end of something that looks as if it should go through the compiler ok, but it doesn't. I'm trying to make a sort-of stop watch that counts in nanoseconds. What did I do wrong, or what am I missing now?
public class Counter
{
long startTime;
long endTime;
public void Stopwatch()
{
long currentTime = System.nanoTime();
startTime = currentTime;
endTime = currentTime;
}
public void start()
{
startTime = System.nanoTime();
}
public void stop()
{
endTime = System.nanoTime();
}
public long getTimeElapsed()
{
return (endTime - startTime);
}
}