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 Threads and Synchronization and the fly likes Threads 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 » Java » Threads and Synchronization
Bookmark "Threads" Watch "Threads" New topic
Author

Threads

Bharadwaj Adepu
Ranch Hand

Joined: Dec 30, 2007
Posts: 99
Consider this code..




the out put is
End
run


Am not able to understand the flow


SCJP 1.5
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

What dont you understand there ? Why you got Exception is that your throwing it.

Heres my code

[ July 20, 2008: Message edited by: mandlar suurla ]
satishkumar janakiraman
Ranch Hand

Joined: May 03, 2004
Posts: 334
I think he wants to know why End is printing first. If I am correct, I would suggest you to read join

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Originally posted by mandlar suurla:

Heres my code


Don't know what this adds to the discussion. You would never call "run()" on a Thread, as it's only by calling "start()" that you invoke the special behavior of a thread. And of course the "Runnable" route is preferable to subclassing Thread. satishkumar's advice is good.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads
 
Similar Threads
Can we only start() a thread?
Thread
a tip on threads: (follow up)
main method problem
Question about Threads