I want to retrieve the reference variable name.
This works fine
    MyClass c1=new MyClass("A0001");
    c1.myMethod(c1);
    System.out.println(c1.Persons.get(0).Name); // output is: A0001_1 
The classes are:
 class MyClass{  
    public List<Person> Persons = new ArrayList<Person>();  
    public String name="";  
    MyClass(String name){  
        this.name=name;  
    }  
    void myMethod(MyClass c){  
        Persons.add(new Person(c));  
    }  
}  
class Person{  
    public static int Num=0;  
    public String Name="";  
    Person(MyClass c){  
        Num++;  
        this.Name=c.name+"_"+Num;  
    }  
}  
but I want it to be like this
    MyClass c1=new MyClass("A0001");
    c1.myMethod();
    System.out.println(c1.Persons.get(0).Name);
class MyClass{  
    public List<Person> Persons = new ArrayList<Person>();  
    public String name="";  
    MyClass(String name){  
        this.name=name;  
    }  
    void myMethod(this){  
         // which Reference Variable calls this method?
        System.out.println("name of the Reference Variable="+???);
        Persons.add(new Person(this));  
    }  
what can I put to ???
how programmatically can we show "c1" in ???
 
     
     
    