Birthdate. Java objectoperation. Java

Source: Internet
Author: User

Public class birthdate {
/**
* Private int day; private int month; Public int year; Public int getday ()
* {Return day;} public void setday (INT day) {This. Day = day;} public
* Int getmonth () {return month;} public void setmonth (INT month ){
* This. month = month;} public int getyear () {return year;} public void
* Setyear (INT year) {This. Year = year;} public void show (){
* System. Out. println ("birthdate =" + year + "--" + month + "--" + day );}
**/
Private int Day;
Private int month;
Public int year;

Public void setday (int ){
Day =;
}

Public int getday (){
Return day;
}

Public void setmonth (int B ){
Month = B;

}

Public int getmonth (){
Return month;
}

Public void setyear (INT c ){
If (C <0 | C> 2000 ){
Return;
}
Else
Year = C;

}

Public int getyear (){
Return year;
}

Public void show (){
System. Out. println ("birthdate =" + getyear () + "--" + getmonth () + 2 + "--" + day + 1 );
System. Out. println ("birthdate =" + getyear () + "--" + getmonth () + "--" + day + "1 ");
System. Out. println ("birthdate =" + getyear () + "--" + getmonth () + "--" + getday () + 1 );
System. Out. println ("birthdate =" + getyear () + "--" + getmonth () + "--" + getday () + "1 ");
}

}

 

 

Public class objectoperation {
Public static void main (string ARGs [])
{
Birthdate B = new birthdate ();
B. setday (23 );
B. setmonth (5 );
B. setyear (1986 );
B. setyear (19990 );
B. Show ();





}
 

}

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.