public class Pair< T1, T2 >{

    private T1 first;
    private T2 second;

    public Pair( T1 first, T2 second){
        this.first = first;
        this.second = second;
    }

    public void setFirst( T1 first ){
        this.first = first;
    }

    public T1 getFirst( ){
        return first;
    }

    public void setSecond( T2 second ){
        this.second = second;
    }

    public T2 getSecond( ){
        return second;
    }

    @Override
    public String toString(){
        return "Pair: " + first.toString() + ", " + second.toString();
    }


    public static void main( String[] args ){

        String myStr = new String( "Hello" );
        Integer myInt = 42;
        Double myDouble = 3.141596;
        Character myChar = '1';

        Pair< String, Integer > strInt = new Pair< String, Integer >( myStr, myInt );
        String str = strInt.getFirst();
        System.out.println( "First: " + str );
        System.out.println( strInt );

        System.out.println();

        Pair< Double, Character > doubleChar = new Pair< Double, Character >( myDouble, myChar );
        Double d = doubleChar.getFirst();
        System.out.println( "First: " + d );
        System.out.println( doubleChar );

    }
}