码迷,mamicode.com
首页 > 编程语言 > 详细

JAVA中implements的用法

时间:2016-12-09 08:02:28      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:str   main   imp   ring   stat   nts   []   void   public   

implements使用

interface Sport {

      void run();

      void jump();

}

class Athlete implements Sport {

          public void run() {

            System.out.println("短跑");

         }

         public void jump() {

            System.out.println("跳高");

         }

 

         public static void main(String[] args) {

          Ahtlete al=new Ahtlete();

                al.run();

                al.jump();

          }

}

JAVA中implements的用法

标签:str   main   imp   ring   stat   nts   []   void   public   

原文地址:http://www.cnblogs.com/Logo-TPM/p/6147798.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!