In Java
For this problem you must define a simple generic interface Pair Interface, and two implementations of the interface, BasicPair and ArrayPair. Define a Java interface named Pairlnterface. A class that implements this interface allows creation of an object that holds a \"pair\" of objects of a specified type-these are referred to as the \"first\" object and the \"second\" object of the pair. We assume that classes implementing Pairlnterface provide constructors that accept as arguments the values of the pair of objects. The Pairlnterface interface should require both setters and getters for the first and second objects. The actual type of the objects in the pair is specified when the Pairlnterface object is instantiated. Therefore, both the Pairlnterface interface and the classes that implement it should be generic. Suppose a class named BasicPair implements the Pairlnterface interface. A simple sample application that uses BasicPair is shown here. Its output would be \"apple orange.\" public class Sample {public static void main (String!] args) {Pairlnterface myPair - new BasicPair(\"apple\", \"peach\"); System.out.print(myPair.getFirst() + \" \"): myPair.setSecond(\"orange\"); System.out.printIn(myPair.getSecond());)} Create a class called BasicPair that implements the Pairlnterface interface. This class should use two instance variables, first and second, to represent the two objects of the pair. Create a test driver application that demonstrates that the BasicPair class works correctly. Create a class called ArrayPair that implements the Pairlnterface interface. This class should use an array^10 of size 2 to represent the two objects of the pair. Create a test driver application that demonstrates that the ArrayPair class works correctly.
Please create interface in eclipse or whatever you are using please do paste the below code
------
public interface PairInterface<S> // created generic interface
{
void setFirst(String first);
String getFirst();
void setSecond(String second);
String getSecond();
}
-------
Please create Basicpair class and please do paste the below code:
-----
public class BasicPair<T> implements PairInterface<String> // created generic class
{
public String first;
public String second;
public BasicPair(String first, String second) {
super();
this.first = first;
this.second = second;
}
public String getFirst() {
return first;
}
public void setFirst(String first) {
this.first = first;
}
public String getSecond() {
return second;
}
public void setSecond(String second) {
this.second = second;
}
}
------
and run the code using sample class you would get output as expected.