Chapter 15 - Exercise 15

(1) Verify the previous statement.


Exercise15.java



package com.ciaoshen.thinkinjava.newchapter15;
import java.util.*;

public class Exercise15 {
    private static class TwoTuple<A,B>{
        private A a;
        private B b;
        public TwoTuple(A a,B b){
            this.a = a;
            this.b = b;
        }
        public String toString(){return "["+ a +","+ b +"]";}
    }
    private static <U,V> TwoTuple<U,V> twoTuple(U u, V v) {
        return new TwoTuple(u,v);
    }
    public static void main(String[] args) {
        TwoTuple<String,Integer> two = twoTuple("Hello World", 100);
    }
}



Need Java Developers? Hire Me »

I know Java. Talk is cheap, watch my code.

I live in CANADA now.