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

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -