class A{
String name;
public A(String str){
name=str;
}
public void f1(){
System.out.println("f1() of name"+name+"is invoked!");
}
public void f2(){
A a2=new A("a2");
this.f1();
a2.f1();
}
}
public class
class A{
String name;
public A(String str){
name=str;
}
public void f1(){
System.out.println("f1() of name"+name+"is invoked!");
}
public void f2(){
A a2=new A("a2");
this.f1();
a2.f1();
}
}
public class TestTHIS {
public static void main(String[] args) {
// TODO 自动生成的方法存根
A a1=new A("a1");
a1.f2();
}
}
{
public static void main(String[] args) {
// TODO 自动生成的方法存根
A a1=new A("a1");
a1.f2();
}
}
时间: 2024-12-28 01:01:10