day09-接口的抽象方法的定义和使用

This commit is contained in:
2026-01-23 13:42:47 +08:00
parent f44e8b3cff
commit 0b1e49133d
3 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
package com.inmind.interface01;
/*
接口中抽象方法定义:
public abstract 返回值类型 抽象方法名();
但凡在接口中定义一个没有方法体{}的方法就是public abstract修饰暂时不省略
*/
public interface MyInterface {
public abstract void method();//抽象方法
public abstract void method1();//抽象方法
int method2();//省略了public abstract 的抽象方法
}