java - Shared data between clients in socket -
If I have class A and 2 threads from class B, and I think the thread is in class A to variable X I want to reach i a thread manipulates that variable, how does the thread of the first value of x get the second thread?
For example
public class A {public static x = 0; Public static zero manipulation {x ++; }}
and for example class B:
executes the public class B. Runnable {Public is run from zero (a.manipulate); }}
If I run 2 threads, then from 1st to x will be set, and second set x to 2, is that correct? If not true, how do I?
Comments
Post a Comment