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...
Type: Posts; User: curmudgeon
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...
This looks like a homework assignment. Please post the actual assignment text. Let's see exactly what your requirements are.
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.
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...