Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Erandika Withanage
Greenhorn
Posts: 14
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Erandika Withanage
Greenhorn
Posts: 14
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. It works perfectly now.

Just wondering about the underlying reason?

Seems there's no escaping the good ole' command line.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic