A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© 周飞飞 中级黑马   /  2015-8-9 09:55  /  250 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文



abstract class GetTime{
       
        public final void getTime(){
                 long        start = System.currentTimeMillis();
                 runcode();
                 long  end  = System.currentTimeMillis();
                 System.out.println(" 毫秒差值:  "+(end - start));
        }
        public abstract void runcode();
}
class SubTime extends GetTime{

        @Override
        public void runcode() {
                // TODO Auto-generated method stub
                for(int i = 0;i<10000;i++){
                        System.out.println(i);
                       
                }
        }
       
}

public class TemplateDemo {
        public static void main(String []args){
//                GetTime        g = new GetTime();
                SubTime g = new SubTime();
                g.getTime();
        }

}

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马