Skip to content

Commit 04a771f

Browse files
committed
Restructure
1 parent 185b0a0 commit 04a771f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//package thread;
2+
class counter {
3+
Integer count = 0;
4+
5+
public void increament() {
6+
count++;
7+
}
8+
}
9+
public class Exp9_3 {
10+
public static void main(String[] args) throws Exception {
11+
counter c = new counter();
12+
Thread t1 = new Thread(new Runnable() {
13+
public void run() {
14+
for (Integer i = 0; i < 1000; i++) {
15+
c.increament();
16+
}
17+
}
18+
});
19+
t1.start();
20+
t1.join();
21+
System.out.println(c.count);
22+
}
23+
24+
}

0 commit comments

Comments
 (0)