• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread q from m. green

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following is from marcus green test 1

When executed It prints "vandeleur". Why is that so ? I thought it should have been something like "vandeleur 0 1 2 3" because run() gets executed when start() is called .. right ?
-Sam
 
sam pitt
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never mind ranchers.. I found a similar thread here
http://www.javaranch.com/ubb/Forum24/HTML/010591.html
Thanks
Sam
 
Ranch Hand
Posts: 147
Android Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep, run gets executed, but remember that two threads are running. main() prints before run() finishes.
That is:
main() calls piggy(),
piggy() starts the new thread and returns,
main() prints, (what it has for sName..."vandeleur")
then run finishes executing.
(I think...I could be wrong!)
Oops, sorry I was too slow.....

[This message has been edited by Glen Tanner (edited July 30, 2001).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic