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();

          }

}

相关文章:

  • 2022-02-02
  • 2021-10-17
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
猜你喜欢
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
相关资源
相似解决方案