โ Back to Classes
Question 173
Build a Generic Pair Class
Build a Generic Pair Class
Complete thePair<T>class. Both fields are already declared. Add a constructor that sets them, then complete the two getter methods. IMPORTANT: Do NOT write a main method. A hidden test will createPair<Integer>andPair<Character>objects and verifygetFirst()andgetSecond()return the correct values. Expected Output: 10 20 A B
Expected Output:
10 20 A B
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.