Hi,
Part 1: Implement a class which can be used to measure how long each invocation of the increment and decrement method takes (inpublic interface IncDec { void increment(); void decrement(); } public class MyIncDec implements IncDec { private int x; public MyIncDec(int x) { this.x = x; } public void increment() { this.x++; } public void decrement() { this.x--; } }
milliseconds) and prints out this information. The class should fit in more or less transparently with existing clients of the IncDec interface.
Part 2: Imagine you need to do something similar (timing of method calls) for many places in an application. What other ideas come to mind, e.
My Solution:
My Solution gives me the time diff as 0. When I display the long values before n after calling 'increment', They are the same. Why so?
Thanks,
Maria.