Java-Generic Constructors

Generic Constructors It is possible for constructors to be generic, even if their class is not. For example, in the following program, ShowValue constructor specifies a parameter of a generic type, even though ShowValue is not a generic class, its constructor is generic. Program Program Source class ShowValue { <T> ShowValue(T ob) { System.out.println(“T Value … Read more…