Initialize an object of a generic class

Report a typo

Initialize an object of the generic class Holder to make the code in the main method compile.

The program should print This is an instance of String.

Write a program in Java 17
class Holder<T> {
private T value;

public void set(T value) {
this.value = value;
}

public T get() {
return value;
}
}

class Main {
public static void main(String... args) {
// initialize an instance of Holder to make the code below compiled
Holder...

// do not change the code below
holder.set("This is an instance of String");

String value = holder.get();
System.out.println(value);
}
}
___

Create a free account to access the full topic