美文网首页
return "Demo [a=" + a + ", b=" +

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

作者: 哈迪斯Java | 来源:发表于2023-04-14 07:46 被阅读0次

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);
}

}

相关文章

网友评论

      本文标题:return "Demo [a=" + a + ", b=" +

      本文链接:https://www.haomeiwen.com/subject/dmvhddtx.html