`
hnjzsyjyj
  • 浏览: 27448 次
  • 性别: Icon_minigender_1
  • 来自: 南京
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

接口的扩展

 
阅读更多
package ch09;  //P142

//interface A
interface A{
	void meth1();
	void meth2();
}

//interface B
interface B extends A{
	void meth3();
}

//class MyClass
class MyClass implements B{
	public void meth1() {
		System.out.println("meth1");
		}

	public void meth2() {
		System.out.println("meth2");
		}

	public void meth3() {
		System.out.println("meth3");
		}
}

//main
public class InterfaceExtends {
	public static void main(String[] args) {
		MyClass ob=new MyClass();
		ob.meth1();
		ob.meth2();
		ob.meth3();

	}

}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics