Generic method of java

public class Da {
    public static <A,T>T add(A a, T b)  {

        return b;
    }

    public static void main(String[] args) {
        String a = "aaa";
        Integer b = 9;
        System.out.println(add(a,b));
    }
}
  1. Generic method defined in the return value, to the plurality of words separated by commas.
  2. It can also be defined on the class.
Published 202 original articles · won praise 6 · views 30000 +

Guess you like

Origin blog.csdn.net/fall_hat/article/details/104064169