//www.xinshuguang.org
//新曙光培训@未央
interface myActionListener{}
//这个接口的作用是让func2和func3有同样类型的参数
//而后这种参数又由不同的类去实现
class myButton{
public void func2(myActionListener k){System.out.println("func2: "+k);}
public void func3(myActionListener k){System.out.println("func3: "+k);}
}
class AboutThis implements myActionListener{
myButton oneButton;
AboutThis(){
System.out.println("新曙光@未央");
class InsideThis implements myActionListener{
InsideThis(){
System.out.println("www.xinshuguang.org");
}
}
oneButton =new myButton();
oneButton.func2(this);
//大家看看由此而产生的输出
//与最后一行产生的输出比较,就知道
//this就是AboutThis()这个类的实例
oneButton.func3(new InsideThis());
}//这之上是构造函数
public static void main(String[] args){
AboutThis 这个到底是谁=new AboutThis();
System.out.println("main: "+这个到底是谁);
}
}