74 接口中的方法

接口中的方法包括:抽象方法,默认方法和静态方法。

其中抽象方法没有方法体,用public修饰。

默认方法用default修饰,必须有方法体。

静态方法必须有方法体。

interface A{
	public void test1();
	void test2();
	default void test3() {
		
	}
	static void test4() {
		
	}
}

  

猜你喜欢

转载自www.cnblogs.com/Scorpicat/p/12121374.html
74