12345678910111213141516171819202122232425262728293031 |
- package com.sf.day09.interfacepackage;
- public interface BuildCarsInterface {
- //静态常量 默认是public static final
- int MAX_SPEED = 220;
- int MIN_DISTANCE = 50;
- /**
- * 抽象方法 public abstract
- */
- void runCar();
- void breakCar();
- /**
- * 默认方法 default权限修饰符不能省略
- *
- * void start();
- */
- //默认方法
- default void start(){
- System.out.println("开始");
- }
- //静态方法
- static void show(){
- System.out.println("中国汽车必将走向世界");
- }
- }
|