zjh
2025-04-07 cdfd0e963d66721dfb0410598002273f7d26bc89
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.ltkj.common.utils;
 
public class AgeResult{
    private Integer age;
    private Integer unit;
 
    public AgeResult(Integer age, Integer unit) {
        this.age = age;
        this.unit = unit;
    }
 
    public Integer getAge() {
        return age;
    }
 
    public Integer getUnit() {
        return unit;
    }
 
    @Override
    public String toString() {
        String str = "";
        switch (unit){
            case 1:
                str = "年";
                break;
            case 2:
                str = "月";
                break;
            case 3:
                str = "天";
                break;
            case 4:
                str = "小时";
                break;
            case 5:
                str = "分钟";
                break;
        }
        return "年龄 ->"+age+",单位 ->"+str;
    }
}