What do 3 dots next to a parameter type mean in Java?

前端 未结 12 1714
灰色年华
灰色年华 2020-11-22 00:27

What do the 3 dots following String in the following method mean?

public void myMethod(String... strings){
    // method body
}
12条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 00:51

    Also to shed some light, it is important to know that var-arg parameters are limited to one and you can't have several var-art params. For example this is illigal:

    public void myMethod(String... strings, int ... ints){
    // method body
    }
    

提交回复
热议问题