vendredi 29 mai 2015

Template class in Java

Suppose that there is a class called Test like this

public class Test<A extends X, B extends Y> {
    public int testing(long n) {
       a(new Good(n));
       return 1;
   }
}

I want to use this class as Test<Good, Bad>. Good class is constructed by long type, but this doesn't work because a function in testing requires A type, not Good. In this case what can I do to use A type?

Aucun commentaire:

Enregistrer un commentaire