Search:

Type: Posts; User: curmudgeon

Search: Search took 0.08 seconds.

  1. Replies
    7
    Views
    3,588

    Re: Synchronized a integer variable in Java

    Again, a variable cannot be synchronized. What probably must be synchronized is the method that sets this variable. Make this variable volatile, and then you will need to use a shared Object that it...
  2. Replies
    7
    Views
    3,588

    Re: Synchronized a integer variable in Java

    This looks like a homework assignment. Please post the actual assignment text. Let's see exactly what your requirements are.
  3. Replies
    7
    Views
    3,588

    Re: Synchronized a integer variable in Java

    If it's to be a constant, then make it a final variable. Or if I'm misunderstanding you, please clarify your problem some more.
  4. Replies
    7
    Views
    3,588

    Re: Synchronized a integer variable in Java

    This doesn't make sense. What do you mean by "synchronize" a variable. This cannot be done in Java, period. You can synchronize on an *object* not a variable, and it's often an object that is not...
Results 1 to 4 of 4