📄 simpledate.java
字号:
package Entities;
/** A simple class that represents a date */
public class SimpleDate implements Cloneable
{
public SimpleDate(int nDay, int nMonth, int nYear)
{
day = nDay;
month = nMonth;
year = nYear;
}
public int day;
public int month;
public int year;
public void incDay()
{
if (day < 30)
day++;
else
{
day = 1;
if (month < 12)
month++;
else
{
month = 1;
year++;
}
}
}
/** A method which return the clone of the Shape <br>
Analysis : Time = O(1) */
public Object clone()
{
try
{
return super.clone();
}catch (CloneNotSupportedException s) {}
return this;
}
public String toString()
{
return (day + "/" + month + "/" + year);
}
} /* end of SimpleDate */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -