- class Test1
- {
- public static void main(String[] args)
- {
- Test3 t = new Test3();
- t.run();
- }
- }
- abstract class Test2
- {
- public final long run() {
- long start = System.currentTimeMillis();
- code();
- long end = System.currentTimeMillis();
- return end - start;
- }
- public abstract void code();
- }
- class Test3 extends Test2
- {
- public void code() {
- int i = 0000;
- while(i < 10000)
- {
- System.out.println("x");
- i++;
- }
- }
- }
复制代码
应该输出x之后就有个毫秒值啊,冯佳老师的有我的没有,输出完了没有毫秒数. |
|