CJCoding With Joseph
15free / daySign inCreate account

Copy a Generic Value into a Box

Complete the generic method copyIntoBox in the BoxTools class. It receives a Box<T> and a value of type T, and should store that value in the box using its setItem method.

The full Box class and the method signature are already provided.

IMPORTANT: Do NOT write a main method. A hidden test will create String and Integer boxes, call copyIntoBox to update them, then print the new stored values using getItem().

Expected Output:

new value
50

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
GenericsMethods
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.