Search:

Type: Posts; User: Norm

Search: Search took 0.10 seconds.

  1. Re: How to synchronised a variable in a class such that the variable will remain each time a thread is run

    What is the value of numOfball used for?

    What does a message with "throw" mean? How does that message relate to the value of numOfball?

    Please edit your post and wrap your code with code tags:...
  2. Re: How to synchronised a variable in a class such that the variable will remain each time a thread is run

    Why does the code copy the value of numOfball from the Ball object it just created?

    WHere is the code that calls a set method ONE TIME to set the value of numOfball that all the Ball objects to...
  3. Re: How to synchronised a variable in a class such that the variable will remain each time a thread is run

    Then why does the constructor set the value of numOfball? Each call of a constructor will change its value?

    Why not set it one time from outside of the constructor?
  4. Re: How to synchronised a variable in a class such that the variable will remain each time a thread is run

    Can you describe what values the numOfball variable is supposed to hold? Should each instance of the Ball class have its own value? Making it static means that all instances share the ONE variable....
  5. Re: How to synchronised a variable in a class such that the variable will remain each time a thread is run

    Why does each constructor set the value of the static variable? Each one is changing the value that the last one set.
    There is only one copy of a static variable shared among all the class objects....
  6. Re: How to synchronised a variable in a class such that the variable will remain each time a thread is run

    Please post a small complete program that compiles, executes and shows the problem.
    Be sure to wrap your code with code tags:


    <YOUR CODE HERE>

    to get highlighting and preserve formatting.
  7. Re: How to synchronised a variable in a class such that the variable will remain each time a thread is run

    Not sure what "synchronized" means here.
    Can you post some output from the program that shows what you are talking about? Add some comments to explain what the problem is.

    Please edit your...
Results 1 to 7 of 7