Tag: OS new Re C public return
Package CN. itcast. day1;
Public class weekday0 {
Private weekday0 (){}
Public static final weekday0 sun = new weekday0 ();
Public static final weekday0 MON = new weekday0 ();
Public static final weekday0 tus = new weekday0 ();
Public static final weekday0 Wen = new weekday0 ();
Public static final weekday0 Thu = new weekday0 ();
Public static final weekday0 Fri = new weekday0 ();
Public static final weekday0 sat = new weekday0 ();
Public weekday0 nextday (){
If (this = Sun ){
Return mon;
} Else if (this = Mon ){
Return tus;
} Else if (this = tus ){
Return Wen;
} Else if (this = Wen ){
Return Thu;
} Else if (this = Thu ){
Return Fri;
} Else if (this = Fri ){
Return sat;
} Else {
Return sun;
}
}
Public String tostring (){
If (this = Sun ){
Return "sun ";
} Else if (this = Mon ){
Return "mon ";
} Else if (this = tus ){
Return "tus ";
} Else if (this = Wen ){
Return "Wen ";
} Else if (this = Thu ){
Return "Thu ";
} Else if (this = Fri ){
Return "fri ";
} Else {
Return "sat ";
}
}
}