โ Back to Methods
Question 172
Write a Generic Printer Method
Write a Generic Printer Method
Complete the generic static methodprintIteminside thePrinterclass. It takes one parameter of any type and prints it to the console. IMPORTANT: Do NOT write a main method. A hidden test will callPrinter.printItem("Java"),Printer.printItem(25), andPrinter.printItem(2.5)and verify each value prints on its own line. Expected Output: Java 25 2.5
Expected Output:
Java 25 2.5
Topics:
GenericsMethods
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.