java generics and c++ templates
<p>I am little confused on how templates in c++ and generics in java work. it would be helpful if someone explained me how this java code will be c++:</p>

<pre><code>public class Box&lt;T&gt; {

    private T t;          

    public void add(T t1) {
        this.t = t1;
    }

    public T get() {
        return t;
    }

    public &lt;U&gt; void inspect(U u){
        System.out.println("T: " + t.getClass().getName());
        System.out.println("U: " + u.getClass().getName());
    }

    public static void main(String[] args) {
        Box&lt;Integer&gt; integerBox = new Box&lt;Integer&gt;();
        integerBox.add(new Integer(10));
        integerBox.inspect(10);
    }
}
</code></pre>
