Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Fetching Class Name from a static method

807603Aug 9 2005 — edited Jan 31 2008
Hi,

I want to find the name of the Class, without instantiating the class.
Consider Class XYZ, which has a static method as method1()

public static String method1(){
// this method should return the name of the class as 'XYZ'
}

In class PQR, i would be calling the mthod1 as
String classname = XYZ.method1();

Is this possible, if yes, how do I do this.

Please reply.

Many Tx.
Mukta
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 28 2008
Added on Aug 9 2005
26 comments
419 views