-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerics3.java
More file actions
63 lines (49 loc) · 1.3 KB
/
Generics3.java
File metadata and controls
63 lines (49 loc) · 1.3 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import java.util.Calendar;
/**
* Created by Admin on 12-04-2017.
*/
public class Generics3 {
public static <T> void print(T t){
System.out.println(((Object)t).toString());
}
public static void main(String[] args){
print("abc");
print(2);
print(new Runnable() {
@Override
public void run() {
}
});
print(new Calendar() {
@Override
protected void computeTime() {
}
@Override
protected void computeFields() {
}
@Override
public void add(int field, int amount) {
}
@Override
public void roll(int field, boolean up) {
}
@Override
public int getMinimum(int field) {
return 0;
}
@Override
public int getMaximum(int field) {
return 0;
}
@Override
public int getGreatestMinimum(int field) {
return 0;
}
@Override
public int getLeastMaximum(int field) {
return 0;
}
});
print(new Integer(1));
}
}