Just attempting this question I found in a past exam paper so that I can prepare for an upcoming Java examination.
Provide a generic class Pair for representing pair
No. Have you tried coding it to see if it works?
You seem to have missed this part of the requirement:
The class should be parameterised over two types one for the first member and one for the second member of the pair.
Which means the class should probably be defined as something more like:
public class Pair
and the other methods updated accordingly. (By the way, I've used T1 and T2 to refer to the types as by convention a short - 1 or 2 char - identifier is used).
Also,
return thing.first;
and
return thing.second;
are not going to work, as in your example, thing is a type, not an object. Think about what you want to return here. Do you even need to call a method?
Once you've made your changes, code it and either write a unit test or a simple test-harness to check if it works.