forked from sheeju/git-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.java
80 lines (59 loc) · 1.42 KB
/
main.java
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Collections;
import java.util.Date;
import java.lang.Thread;
class B
{
}
class A
{
private int i;
public A(int i)
{
this.i = i;
}
public A(A a)
{
this.i = a.i;
}
public int i()
{
return i;
}
}
class Main
{
public static void main(String args[]) throws InterruptedException
{
System.out.println("Testing classes");
A o = new A(3);
A otherO = new A(o);
System.out.println("otherO.i(): " + otherO.i());
System.out.println("Testing Lists and Iterators");
Date a = new Date();
// Thread.sleep(1000);
Date b = new Date();
// Thread.sleep(1000);
Date c = new Date();
List<Date> list = new ArrayList<Date>();
list.add(c);
list.add(a);
list.add(b);
Collections.sort(list);
Iterator<Date> i = list.iterator();
while(i.hasNext())
{
System.out.println("\n" + i.next());
}
System.out.println("Testing Date");
System.out.println("a.getTime: " + a.getTime());
System.out.println("a compared to b: " + a.compareTo(b));
System.out.println("Testing Integer");
System.out.println("a compared to b" + (new Integer(1)).compareTo(new Integer(2)));
System.out.println("Testing String");
String s = "Hey I am a 3, 3";
System.out.println("Replace: " + s.replaceAll("3", "Dude"));
}
}