java - Shared data between clients in socket -
if have class , 2 threads class b, , want thread access variable x in class if 1 of thread manipulate in variable, how sec thread lastly value of x resultant form first thread?
for example
public class { public static int x = 0; public static void manipulate{ x++; } }
and class b example:
public class b implements runnable{ public void run{ a.manipulate(); } }
if run 2 threads, first set x 1, , sec set x 2, true? if not true, how that?
java multithreading sockets client-server
No comments:
Post a Comment