-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDate (2).java
49 lines (48 loc) · 1.22 KB
/
Date (2).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
public class Tarix {
private int day;
private int month;
private int year;
public Tarix(int day){
this(day,0,2000);
}
public Tarix(int day,int month,int year){
this.day=day;
this.month=month;
this.year=year;
}
public Tarix(int day,int month){
this.day=day;
this.month=month;
this.year=2000;
}
public Tarix(){
this(0,0,2000);
}
public Tarix(Tarix t){
this(t.getDay(),t.getMonth(),t.getYear());
}
public int getDay(){
return day;
}
public int getMonth(){
return month;
}
public int getYear(){
return year;
}
public void setDay(int day){
this.day=day;
}
public void setYear(int year){
if(year<0){
throw new IllegalArgumentException("Il menfi ola bilmez!");}
}
public static void main(String[] args){
Tarix tarix=new Tarix();
Tarix day=new Tarix(1);
Tarix tarix1=new Tarix(2,3);
Tarix tarix2=new Tarix(tarix);
Tarix tarix3=new Tarix(3,6,2015);
System.out.println(tarix3.getDay()+" "+tarix2.getMonth()+" "+tarix1.getYear());
}
}