Search:

Type: Posts; User: hellokitty25

Search: Search took 0.09 seconds.

  1. Replies
    7
    Views
    3,572

    Re: Synchronized a integer variable in Java

    Hi

    I almost got the output. Just that as this is a thread, the numOfballs must be synchronized. Otherwise the numOfball will not be correct.
  2. Replies
    7
    Views
    3,572

    Re: Synchronized a integer variable in Java

    Hi I am trying to create 10 objects of Myclass which extends Thread in the main class. The numOfball is passed to the Myclass objects and return to the main class.
    The numOfball must be...
  3. Replies
    7
    Views
    3,572

    Re: Synchronized a integer variable in Java

    Hi

    What I am trying to achieved is that I will have 10 objects of Myclass which is a thread. The numOfball inside must not be overwrite.

    Regards
  4. Replies
    7
    Views
    3,572

    Synchronized a integer variable in Java

    Hi all

    I am trying to synchronized an integer variable in java.

    An example is as below:

    class Myclass{
    private static int numOfball

    public synchronized void getBall()
Results 1 to 4 of 4