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


Win a copy of Spring in Action this week in the Spring forum!
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: 42289
    
  64
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 - my free Android networking tools app
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.
 
jQuery in Action, 2nd edition
 
subject: Why am I not getting main when getName() is applied to the main method?