forked from natural/java2python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSynchronized2.java
More file actions
36 lines (29 loc) · 776 Bytes
/
Synchronized2.java
File metadata and controls
36 lines (29 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Synchronized2 {
public synchronized void test1() {
System.out.println(1);
}
public synchronized void test1(String s) {
System.out.println(s);
}
public static synchronized void test1(int i) {
System.out.println(i);
}
public static synchronized void test2() {
System.out.println(2);
}
public static synchronized void test2(String s) {
System.out.println(s);
}
public synchronized void test2(int i) {
System.out.println(i);
}
public static void main(String[] args) {
Synchronized2 obj = new Synchronized2();
obj.test1();
obj.test1("test1");
obj.test1(1);
obj.test2();
obj.test2("test2");
obj.test2(2);
}
}