class Pair { private T first; private T second; public Pair() { } // first and second automatically initialized as null public Pair(T x1, T x2) { first = x1; second = x2; } @Override public String toString() { return "(1)" + first + " (2)" + second; } } public class Main { public static void main(String[] args) { Pair p0 = new Pair<>(); Pair p1 = new Pair<>("hello", "cheers"); Pair p2 = new Pair<>(true, false); Pair p3 = new Pair<>(123, 456); Pair p4 = new Pair<>(123, 456); Pair p5 = new Pair<>(123, "cheers"); //Error: The constructor Pair(int, String) is undefined //Pair p6 = new Pair(123,"cheers"); System.out.println(p0); System.out.println(p1); System.out.println(p2); System.out.println(p3); System.out.println(p4); System.out.println(p5); } }