aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Why am I not getting main when getName() is applied to the main method? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Why am I not getting main when getName() is applied to the main method?" Watch "Why am I not getting main when getName() is applied to the main method?" New topic
Author

Why am I not getting main when getName() is applied to the main method?

Erandika Withanage
Greenhorn

Joined: Apr 08, 2011
Posts: 14

I want to get the name of the thread running the main() method and my code is as follows.



When execured, what I get is:



I don't get this. According to K&B the thread name should be 'main'? Is it a problem with my settings or IDE (DrJava)?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
I wouldn't call it a "problem" with your IDE, but it is a consequence of using one. Run the code from the command line to see the difference.


Ping & DNS - updated with new look and Ping home screen widget
Erandika Withanage
Greenhorn

Joined: Apr 08, 2011
Posts: 14

Thank you. It works perfectly now.

Just wondering about the underlying reason?

Seems there's no escaping the good ole' command line.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why am I not getting main when getName() is applied to the main method?
 
Similar Threads
Thread State
Thread and volatile
Concurency logic
testing concurrency and sleeping threads
Thread getName( ) method