A staticvariable classin the process will be shared between each thread contained in this process.
, class public static, Threads , .
, , synchronized.
class Foo {
private static int aVariable = 0;
public static synchronized void increment() { aVariable++; }
public static synchronized int getVariable() { return aVariable; }
}