Can a single Java variable accept an array of either primitives or objects?

前端 未结 6 613
走了就别回头了
走了就别回头了 2021-01-03 12:30

For example, for a single method that reads the elements of an array, how can the programmer allow either an array of objects or an array of primitives to be passed as the p

6条回答
  •  半阙折子戏
    2021-01-03 13:10

    What is the context?

    Your situation might be calling for generics, with which you could pass in Collection or Collection as you please.

提交回复
热议问题