return "Demo [a=" + a + ", b=" +

2023-04-14  本文已影响0人  哈迪斯Java

enum Sex {
male, female
}

public class Demo<A, B, C> {
A a;
B b;
C c;

public Demo(A a, B b, C c) {
    this.a = a;
    this.b = b;
    this.c = c;
}

@Override
public String toString() {
    return "Demo [a=" + a + ", b=" + b + ", c=" + c + "]";
}

public static void main(String[] args) {
    Demo<Integer, Integer, Integer> date = new Demo<>(2008, 8, 8);
    System.out.println(date);
    Demo<String, Integer, Sex> tom = new Demo<String, Integer, Sex>("汤姆", 175, Sex.male);
    System.out.println(tom);
}

}

上一篇 下一篇

猜你喜欢

热点阅读