CJCoding With Joseph
15per day

Build a Generic Pair Class

Complete the Pair<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 create Pair<Integer> and Pair<Character> objects and verify getFirst() and getSecond() 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.