BuildCarsInterface.java 608 B

12345678910111213141516171819202122232425262728293031
  1. package com.sf.day09.interfacepackage;
  2. public interface BuildCarsInterface {
  3. //静态常量 默认是public static final
  4. int MAX_SPEED = 220;
  5. int MIN_DISTANCE = 50;
  6. /**
  7. * 抽象方法 public abstract
  8. */
  9. void runCar();
  10. void breakCar();
  11. /**
  12. * 默认方法 default权限修饰符不能省略
  13. *
  14. * void start();
  15. */
  16. //默认方法
  17. default void start(){
  18. System.out.println("开始");
  19. }
  20. //静态方法
  21. static void show(){
  22. System.out.println("中国汽车必将走向世界");
  23. }
  24. }