Forums Register Login

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

+Pie Number of slices to send: Send
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)?
1
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thank you:). It works perfectly now.

Just wondering about the underlying reason?

Seems there's no escaping the good ole' command line.
knowledge is the difference between drudgery and strategic action -- tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 827 times.
Similar Threads
testing concurrency and sleeping threads
Thread getName( ) method
Concurency logic
Thread State
Thread and volatile
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 14:35:55.