Correct the program

Report a typo

Correct the code to make it compilable. The program should print Passed value: value

Write a program in Java 17
class Main {
public static void main(String... args) {
// correct the next line
Printer<Integer> printer = new Printer();

// do not change the code below
printer.set("value");
printer.print();
}
}

class Printer<T> {
private T value;

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

void print() {
System.out.println("Passed value: " + value);
}
}
___

Create a free account to access the full topic