This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Run method question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Run method question" Watch "Run method question" New topic
Author

Run method question

Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
Can we overload or override the run method of thread?
If yes, can you explain me with example please...


Thanks<br />Dinesh
ramesh maredu
Ranch Hand

Joined: Mar 15, 2008
Posts: 210

run method is also like normal method we can overload and override it,in fact it is already overrided in Thread class, it is actually from Runnable interface.
If we override run method in our class when thread is started it will call our run method,but if we overload it,it will not get called automatically.



SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Again...
Dinesh, wouldn't it have been faster and more meaningful for you to try do do this in a small program of your own?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Run method question
 
Similar Threads
main method
Static Methods?
how to make simple sleep()
Using interupt to stop the Thread
Calling Thread's run V/s Runnable's run