美文网首页日常记录
String... args VS String[] args

String... args VS String[] args

作者: FinalException | 来源:发表于2020-01-13 20:21 被阅读0次

    categories:

    • 日常记录
      tags:
    • Java

    (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

    相关文章

      网友评论

        本文标题:String... args VS String[] args

        本文链接:https://www.haomeiwen.com/subject/hvmnactx.html