当前位置 : 主页 > 编程语言 > java >

Interface默认实现

来源:互联网 收集:自由互联 发布时间:2021-06-28
Interface default public interface IInterface {default String test() {return "this is test";};}public class Interface implements IInterface {public static void main(String[] args) {Interface interface1 = new Interface();System.out.println(i
Interface default
public interface IInterface {
	default String test() {
		return "this is test";
	};
}

public class Interface implements IInterface {

	public static void main(String[] args) {
		Interface interface1 = new Interface();
		System.out.println(interface1.test());
	}

}
网友评论