📄 javadocdemo.java
字号:
//javadocDemo.Java
/**
* <p>Title: javadocDemo</p>
* <p>Description: This class use to demo javadoc.</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: Tsinghua University</p>
* @version 1.1
* @see java.lang.Object
* @author 赵艳铎
*/
public class javadocDemo{
private int year;
private int month;
private int day;
/**
* javadocDemo constructor initializes each instance variable
* to 2003.1.1.
* @throws <code>Exception</code> in the case of an invalid day
*/
public javadocDemo() throws Exception{
setDate( 2003, 1, 1 );
}
/**
* javadocDemo constructor: year supplied, month and day
* defaulted to 1
* @param y the year
* @throws <code>Exception</code> in the case of an invalid day
*/
public javadocDemo( int y ) throws Exception{
setDate( y, 1, 1 );
}
/**
* javadocDemo constructor: year and month supplied, day
* defaulted to 1
* @param y the year
* @param m the month
* @throws <code>Exception</code> in the case of an invalid day
*/
public javadocDemo( int y, int m ) throws Exception {
setDate( y, m, 1 );
}
/**
* javadocDemo constructor: year, month and day supplied
* @param y the year
* @param m the month
* @param d the day
* @throws <code>Exception</code> in the case of an invalid day
*/
public javadocDemo( int y, int m, int d ) throws Exception{
setDate( y, m, d );
}
// Set Methods
/**
* Set a new day value using universal day. Perform
* validity checks on data. Set invalid values to zero.
* @param y the year
* @param m the month
* @param d the day
* @see javadocDemo#setYear
* @see javadocDemo#setMonth
* @see #setDate
* @throws <code>Exception</code> in the case of an invalid day
*/
public void setDate( int y, int m, int d ) throws Exception{
setYear( y ); // set the year
setMonth( m ); // set the month
setDate( d ); // set the day
}
/**
* Sets the year
* @param y the year
* @throws Exception in the case of an invalid day
*/
public void setYear( int y ) throws Exception{
if ( y >= 1 && y < 2004 )
year = y;
else
throw new Exception();
}
/**
* Sets the month
* @param m the month
* @throws Exception in the case of an invalid day
*/
public void setMonth( int m ) throws Exception{
if ( m >= 1 && m < 12 )
month = m;
else
throw new Exception();
}
/**
* Sets the day
* @param d the Day
* @throws Exception in the case of an invalid day
*/
public void setDate( int d ) throws Exception{
if ( d >= 1 && d < 31 )
day = d;
else
throw new Exception();
}
// Get Methods
/**
* Gets the year
* @return an <code>int</code> specifying the year.
*/
public int getYear(){
return year;
}
/**
* Gets the month
* @return an <code>int</code> specifying the month.
*/
public int getMonth(){
return month;
}
/**
* Gets the day
* @return an <code>int</code> specifying the day.
*/
public int getDate(){
return day;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -