WA:不懂。。。
//import java.util.*;
import java.util.Arrays;
import java.util.Scanner;
class Time {// 构造time类
int h;
int m;
int s;
/*public void SetHour(int h) {
if (h >= 0 && h <= 12) {
this.h = h;
} else {
this.h = 12;
}
// return this.hour;
}
public void SetMinute(int m) {
if (m >= 0 && m <= 60) {
this.m = m;
} else {
this.m = 0;
}
// return this.minute;
}
public void SetSecond(int s) {
if (s >= 0 && s <= 60) {
this.s = s;
} else {
this.s = 0;
}
}
*/
//简化版
Time(int h,int m,int s){
this.h=h;
this.m=m;
this.s=s;
}
public void SetHour(int h){
if(h<0||h>12)
this.h=12;
}
public void SetMinute(int m){
if(m<0||m>60)
this.h=0;
}
public void SetSecond(int s){
if(s<0||s>60)
this.s=0;
}
public void Show() {
System.out.printf("%02d:%02d:%02d\n",h,m,s);
//The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String,
//int, int, int)
}
}
public class Main {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
/*
* Time time=new Time();//构造方法的默认的,内无语句。 int h2=input.nextInt(); int
* m2=input.nextInt(); int s2=input.nextInt();
* time.SetandShowTime(h2,m2,s2);//调用方法
*/
String s = input.nextLine();// 包含空格
String str[] = s.split(" ");
int h2 = Integer.parseInt(str[0]);// 把字符转换成整型
int m2 = Integer.parseInt(str[1]);
int s2 = Integer.parseInt(str[2]);
Time t = new Time(h2,m2,s2);
t.SetHour(h2);
t.SetMinute(m2);
t.SetSecond(s2);
t.Show();
}
}