← Back to Classes
Question 181
Make a Generic Wrapper Class
Make a Generic Wrapper Class
Complete theWrapper<T>class. The field is already declared. Add a constructor that stores the value, and complete theshowValue()method so it prints the stored item. IMPORTANT: Do NOT write a main method. A hidden test will create aWrapper<String>with "Hello" and aWrapper<Double>with 8.5, then callshowValue()on each.
Expected Output:
Hello 8.5
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
GenericsClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.