CJCoding With Joseph
15per day

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

Expected Output:

Joseph
95
Math
A
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.