• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Concurrency with Threads

 
Joey Sanchez
Ranch Hand
Posts: 88
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • 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: 88
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • 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?







 
Helen Ma
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • 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.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic