This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | Next revision Both sides next revision | ||
|
java:synchronization [2017/03/19 18:25] gthanos |
java:synchronization [2017/03/19 18:27] gthanos |
||
|---|---|---|---|
| Line 23: | Line 23: | ||
| } | } | ||
| + | } | ||
| + | |||
| + | class Counter { | ||
| + | private int c = 0; | ||
| + | public void increment() { c++; } | ||
| + | public void decrement() { c--; } | ||
| + | public int value() { | ||
| + | return c; | ||
| + | } | ||
| } | } | ||
| </ | </ | ||