// Multiple.java // demonstrates the use of multiple type parameters in a generic class import java.util.Scanner; class Pair { private Type1 first; private Type2 second; public Pair(Type1 first, Type2 second) { this.first = first; this.second = second; } public Type1 getFirst() { return first; } public Type2 getSecond() { return second; } } public class Multiple { public static Pair getInfo() { Scanner in = new Scanner(System.in); System.out.println("What is your name? "); String name = in.next(); System.out.println("What is your age? "); int age = in.nextInt(); return new Pair(name, age); } public static void main(String args[]) { Pair info = getInfo(); System.out.println("Hello " + info.getFirst() + ". You are " + info.getSecond() + " years old."); } }