• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Excercise 9-2

 
Ranch Hand
Posts: 176
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to synchronize a block of code as detailed on page 738/739.

I cannot figure out how to access the String that I pass to my MyThreaddy method on lines 9,10 and 11 of the below code.

I wish to access the letters 'a','b' or 'c', depending on the thread on line 33/34.


I hope somebody can help me. Thank you :-)
 
author
Posts: 23956
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Glen Iris wrote:I am trying to synchronize a block of code as detailed on page 738/739.

I cannot figure out how to access the String that I pass to my MyThreaddy method on lines 9,10 and 11 of the below code.

I wish to access the letters 'a','b' or 'c', depending on the thread on line 33/34.


I hope somebody can help me. Thank you :-)




The second parameter to the constructor (in lines 9, 10, and 11) is for the name of the thread ... which you changed in line 13, 14,and 15.

Henry
 
Glen Iris
Ranch Hand
Posts: 176
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Henry.
 
Hot dog! An advertiser loves us THIS much:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic