← Back to Classes
Question 174
Create a Key Value Pair Class
Create a Key Value Pair Class
Complete theKeyValuePair<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 createKeyValuePair<String, Integer>andKeyValuePair<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.