How to use an integer array for a generic method?

后端 未结 1 766
谎友^
谎友^ 2021-01-28 17:29

My insertion sort method is declared using this statement:

    public static > 
          void insertionS         


        
1条回答
  •  梦毁少年i
    2021-01-28 18:10

    Use a wrapper class - Integer. There is something called autoboxing which means that if you pass an argument of primitive type int it will convert automatically to Integer :-)

    http://en.wikipedia.org/wiki/Primitive_wrapper_class https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html

    0 讨论(0)
提交回复
热议问题