为什么打印不出毫秒值哦?- abstract class GetTime
- {
- public final void getTime()
- {
-
- long start = System.currentTimeMillis();
- runcode();
- /*
- for (int x=0;x<1000 ;x++ )
- {
- System.out.print(x);
- }
- */
- long end = System.currentTimeMillis();
- System.out.println("毫秒:"+(end-start));
-
- }
- public abstract void runcode();
- }
- class SubTime extends GetTime
- {
- public void runcode()
- {
-
- //long start=System.currentTimeMillis();
- for (int x=0;x<1000 ;x++ )
- {
-
- System.out.print(x);
- }
- //long end=System.currentTimeMillis();
- //System.out.println("毫秒:"+(end-start));
- }
- }
- class TemplateDemo
- {
- public static void main(String[] args)
- {
-
- SubTime gt=new SubTime();
- gt.runcode();
-
- }
- }
- 只能打印出x 好疑惑~~
复制代码 |
|