• 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

Concurrency with Threads

 
Ranch Hand
Posts: 101
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Practice code from Bates&Sierra's book 4.a
*Create a class that starts one thread from an initialization block, that starts another thread from an inner class, and that starts a third thread from a constructor.

Isn't the statement a little misleading?






I don't think that this is what it is asked to do ¿Do I need at least three classes?
 
Joey Sanchez
Ranch Hand
Posts: 101
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This could be a better approach. From one thread we start the next and so on till the third one. Is it right like this?







 
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joey Sanchez wrote:Practice code from Bates&Sierra's book 4.a
*Create a class that starts one thread from an initialization block, that starts another thread from an inner class, and that starts a third thread from a constructor.

Isn't the statement a little misleading?






I don't think that this is what it is asked to do ¿Do I need at least three classes?



I think this code :

should be

This Inside class starts a new thread in the constructor.



 
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic