Java abstract 抽象类

Java abstract 抽象类

package com.ssm.cts.test;

public abstract class Bike {
  private String name;
  
  public abstract void start();
}
package com.ssm.cts.test;

public class MotoBike extends Bike {

  @Override
  public void start() {
    System.out.println("启动");
  }

}
package com.ssm.cts.test;

public class ClassTest {
    // 测试
  public static void main(String[] args) {
    Bike bike = new MotoBike();
    bike.start();
  }

}

 

发表回复

您的电子邮箱地址不会被公开。