In JAVA, the types are followed by three points.

Source: Internet
Author: User

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}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.