(thread) . , , , , . .
. Java : (implementing) (extending) . . . Java , . (, . start() ..). . . . , , .
. -, / static final (). , , , . -, . , , , . , ( ) . , , , new; , Runnable a = new Runnable(); . Thread. , .
. applet, :
CounterThread Example and Source code
, CounterThread Runnnable, Applet. init(), Cout Thread. this Thread, , . this CounterThread. . start(), run() CounterThread, CounterThread.run(). start() . , run() . , , run(), . run() Count, (sleep) 10 . , sleep . , , , . stop().
|
|
Java Java . , Java /, . .
.
, . , , , . ? , , , MS-DOS, . , , . , , , .
Java . . , Java. , , . , synchronized, :
public synchronized void decrement(){...}( ) . , .
. , synchronized, , , . , . - sleep :
try{ Thread.sleep(500);}catch (InterruptedException ee){...}