Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / November 2006

Tip: Looking for answers? Try searching our database.

Printing the current class and method

Thread view: 
Roy Gourgi - 04 Nov 2006 19:16 GMT
Hi,

How can I print the class and method that is presently running?

For example, if my class that contains main() is called HelloWorld I want to
print out "HelloWorld main".

I would like to use System.out.println() to do it.

TIA
Roy
Martin Weiss - 05 Nov 2006 22:24 GMT
> Hi,
>
[quoted text clipped - 7 lines]
> TIA
> Roy

for the class .. this.getClass() should give you the HelloWorld thing ..
 I'm not sure about the method part though :S
Ingo R. Homann - 06 Nov 2006 12:22 GMT
Hi Roy,

Take a look at the docu of Exception.getStackTrace()!

Hth,
Ingo


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.