Variable array parameters. If a parameter is used, it can be passed or not. If it is passed, it can be passed in parallel or directly an array.
In the method, s is an array. If nothing is passed during the call, the length of s is 0. The length of s is a few.
In addition, more than 1.5 support this function.
Write example:
View sourceprint? 01 public class ThreePoint {
02 public static void main (String [] args ){
03 printString ();
04 System. out. println ("=========== ");
05 printString (new String [] {"I", "and", "you "});
06 System. out. println ("=========== ");
07 printString ("I", "and", "you ");
08}
09
10 public static void printString (String... str ){
11 if (str. length = 0 ){
12 System. out. println ("No parameter is passed. ");
13}
14 for (int I = 0; I <str. length; I ++ ){
15 System. out. println (str [I]);
16}
17 System. out. println ("---------------------");
18 for (String s: str ){
19 System. out. println (s );
20}
21}
22
23}