Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: what is ... (triple dot) operator

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default what is ... (triple dot) operator

    What is the use of ... (triple dot operator)

    for Example please explain below code :

    public PausableThreadPoolExecutor(...) { super(...); }

    From which JDK version it was introduced.. ?


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: what is ... (triple dot) operator

    Do an internet search for the term "java varargs" for java specific info, or "programming ellipsis" for a more general description. Lots of info, for instance, the following link:
    Varargs

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: what is ... (triple dot) operator

    That feature is called varargs, and it's a feature introduced in Java 5. It means that function can receive multiple String arguments:
    The parameter that gets the ... must be the last in the method signature.
    public void myMethod(String... strings){
    for(String whatever : strings)
    {

    }

  4. #4

    Default Re: what is ... (triple dot) operator

    The spread operator allows you to expand an expression in places where you would expect multiple arguments (in functions) or multiple elements (in arrays).

    let someArguments = ['hi','bye'];

    function logArgs (arg1, arg2) {
    return console.log(`${arg1} ${arg2}`);
    }

    logArgs(...someArguments); //hi bye

Similar Threads

  1. Usage of escape code's for controlling form feeds on dot matrix printer
    By gkedar614 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: July 18th, 2013, 10:18 AM
  2. The += assignment operator?
    By jean28 in forum Java Theory & Questions
    Replies: 2
    Last Post: January 19th, 2013, 01:03 AM
  3. Printing with Dot Matix Printer
    By TheQuickBrownFox in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: November 9th, 2012, 02:04 AM
  4. Triple Inheritance
    By Samaras in forum Object Oriented Programming
    Replies: 8
    Last Post: August 26th, 2012, 03:11 AM
  5. about Operator Precedence
    By degar in forum Java Theory & Questions
    Replies: 6
    Last Post: August 12th, 2011, 01:57 AM