-
Notifications
You must be signed in to change notification settings - Fork 0
/
Time.java
53 lines (46 loc) · 816 Bytes
/
Time.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
import java.util.*;
class Time
{
int h;
int m;
int s;
public void display()
{
System.out.println(h + ":" + m + ":" + s);
}
public Time()
{
h = 0;
m = 0;
s = 0;
}
public Time(int n)
{
h = n;
m = n;
s = n;
}
public Time(int n, int n2)
{
h = n;
m = n2;
s = 0;
}
public Time(int n, int n2, int n3)
{
h = n;
m = n2;
s = n3;
}
public static void main(String[] arrstring)
{
Time time1 = new Time();
time1.display();
Time time2 = new Time(6);
time2.display();
Time time3 = new Time(3,12);
time3.display();
Time time4 = new Time(9,43,51);
time4.display();
}
}