I have written a java code and use the Scanner class to get the value from the user and System.nanoTime at the begin and end to get the total time of my code. Is it considering the time while I typing the input?
Asked
Active
Viewed 42 times
0
-
Yes. It also considers all other OS functions between those two lines of time-getting code. – OneCricketeer Oct 01 '18 at 08:13
-
Please refer https://stackoverflow.com/questions/504103/how-do-i-write-a-correct-micro-benchmark-in-java – OneCricketeer Oct 01 '18 at 08:13
1 Answers
0
Yes think it like a normal clock. Whenever you printed Nanotime, it shows that current time in Nanoseconds type.

Arty
- 859
- 2
- 12
- 31