โ 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
Topics:
GenericsClasses
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.