class A
{
public void display()
{
StackTraceElement ste[] = Thread.currentThread().getStackTrace();
System.out.println("method is called from " + ste[2]);
}
}
public class GetCurrentClassName
{
public static void main(String args[])
{
A a = new A();
a.display();
}
}
{
public void display()
{
StackTraceElement ste[] = Thread.currentThread().getStackTrace();
System.out.println("method is called from " + ste[2]);
}
}
public class GetCurrentClassName
{
public static void main(String args[])
{
A a = new A();
a.display();
}
}
|
No comments:
Post a Comment