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

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© pz_xiaoxie 中级黑马   /  2015-9-11 11:10  /  243 人查看  /  5 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

package test;

import org.omg.IOP.Codec;
import org.w3c.dom.DOMError;

public class Test02 {

        public static void main(String[] args) {
                // TODO 自动生成的方法存根
             Demo dm=new Demo();
             dm.getTime();
         }

}
abstract class GetTime{
         public final  void  getTime(){
                 long start=System.currentTimeMillis();
                   code();
                 long end=System.currentTimeMillis();
                 System.out.println("程序运行的时间是:"+(end-start));
                 
         }
         public  void code(){};
}

class Demo extends Test02{
     public void getTime(){
     }
         public void code() {
                for(int x=0;x<10000;x++){
                        System.out.println("x:"+x);
                }
        }
         
}

5 个回复

倒序浏览
搞不定,没输出,大神们求帮忙
回复 使用道具 举报
搞不定,没输出,大神们求帮忙
回复 使用道具 举报
你继承了Test02,应该继承GetTime
回复 使用道具 举报
我有点看不懂,我是新手
回复 使用道具 举报
继承错了~~~
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马