您的位置:首页 > 其它

sth about "this"

2006-04-05 19:52 337 查看
public class Test extends Test2
{
Test() { }

public void testMethod(){
System.out.println("method in Test----son");
}

public static void main(String[] args)
{
Test t=new Test();
t.f();
}
}

class Test2
{
Test2() { }

public void testMethod(){
System.out.println("method in Test2----dad");
}

public void f(){
testMethod();
this.testMethod();
}
}

**********************************************************************************************************

What is the output? This is tricky if you do not know the exact meaning of "this".

*********************************************************************************************************

OUTPUT:

E:/MyDoc/Exercises>java Test
method in Test----son
method in Test----son
.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐