Correct the usage of non-generic class

Report a typo

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

The program should print 256

Write a program in Java 17
class Holder {
private Object value;

public Object getValue() {
return value;
}

public void setValue(Object v) {
this.value = v;
}
}

class Main {
public static void main(String... args) {
Holder holder = new Holder();
holder.setValue(256);

// correct the line to make the code compile
Integer value = holder.getValue();

// do not change
System.out.println(value);
}
}
___

Create a free account to access the full topic