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 parameter? `Object arrayName` will only accept an array of Objects, and generic variables do not accept primitives. Is there a way to accept either type of array without overloading the method? you'll have to use a language besides Java, like Python, Perl, Haskell, etc.
以上就是Can a single Java variable accept an array of either primitives or objects?的详细内容，更多请关注web前端其它相关文章！