CJCoding With Joseph
15free / daySign inCreate account

Create a Key Value Pair Class

Complete the KeyValuePair<K, V> class. The fields are already declared. Add a constructor and complete the two getter methods.

This class uses two independent type parameters — K for the key type and V for the value type.

IMPORTANT: Do NOT write a main method. A hidden test will create KeyValuePair<String, Integer> and KeyValuePair<String, String> objects and verify the getters return the correct values.

Expected Output:

Joseph
95
Math
A

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

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