Operation Problems in Java Generic

Posted by alantheweasel on Stack Overflow See other posts from Stack Overflow or by alantheweasel
Published on 2013-10-28T15:33:18Z Indexed on 2013/10/28 15:54 UTC
Read the original article Hit count: 124

Filed under:
|

I got some problem when i was learning Java Generic :

interface calculator<T, R> {
 public void execute(T t, R r);
}

class executeAdd<T, R> implements calculator<T, R> {
    private T first;
    private R second;

    public executeAdd(T first, R second) {
        super();
        this.first = first;
        this.second = second;
    }

    @Override
    public void execute(T t, R r) {
        // TODO Auto-generated method stub

        Object o = t + r //  ERROR ! What i could do it ?

    }  
}

© Stack Overflow or respective owner

Related posts about java

Related posts about generics