On Aug 7, 1:15 pm, "Mike Schilling" <mscottschill...@hotmail.com>
wrote:
> > In the above, in class D's myOnwer() i need an implementation which
> > tells who's calling the myOwner() i.e from class A or B or C
[quoted text clipped - 7 lines]
> But I agree with the previous commenters; there's probably a better way to
> do whatever it is you're trying to do.
You can declare a contructor in D, which takes a caller name as a
parameter.
Like,
public D(String name)
{
this.name = name;
}
Then, you can print this name.You should pass this name arg from A/B/C
while initializing the constructor. If you want to avoid hardcoding of
the classname, then do it like,
String thisClassName = this.getClass().getName();
then pass it to D's constructor like,
D d = new D (thisClassName);
--
Manivannan.Palanichamy (@) Oracle.com
http://mani.gw.googlepages.com/index.html