package generic; class Construtgeneric<T> { private T value; public Construtgeneric(T value) { this.value = value; } public T getValue() { return value; } public void setValue(T value) { this.value = value; } } public class GenericConstructDemo { pu…
Java中this关键字,this可以调用类的成员变量和成员方法,this还可以调用类中的构造方法.使用这种方式值得注意的是, 只可以在无参构造方法中的第一句使用this关键字调用有参构造方法. public class AnyThting{ public AnyThting(){ this("this 调用有参构造方法"); System.out.println("无参构造方法"); } public AnyThting(String name){ System.…