| 123456789101112131415161718192021 |
- package course;
- /**
- * @author WanJl
- * @version 1.0
- * @title Test05
- * @description
- * @create 2026/7/23
- */
- public class Test05 {
- public static void main(String[] args) {
- MyDefaultInterfaceImpl mdii=new MyDefaultInterfaceImpl();
- mdii.add(1,2); //调用实现类重写后的方法
- mdii.method(); //调用接口的默认方法
- //通过类名直接调用接口的静态方法
- MyDefaultInterface.staticMethod();
- }
- }
|