日常记录

String... args VS String[] args

2020-01-13  本文已影响0人  FinalException

categories:


(String ...) is an array of parameters of type String, where as String[] is a single parameter.

Now here String[] can full fill the same purpose here but (String ...) provides more readability and easiness to use.

It also provides an option that we can pass multiple array of String rather than a single one using String[].

While String[] can be passed into a method taking String... as a parameter, two String[]s cannot. There is no implicit array concatenation that takes place here

上一篇 下一篇

猜你喜欢

热点阅读