java - What is the meaning of ... in a method parameter? Is it a replacement of []? -


this question has answer here:

i looking @ java code , saw use of ... , thought replacement of []

here example using ...:

public studentdata(string firstname,string lastname,double ... list)    {        // initialise instance variables        this.firstname = firstname;        this.lastname = lastname;        this.testscores = testscores;        this.grade = grade;        grade = coursegrade(list); //calc      } 

here example without it:

public studentdata(string firstname,string lastname,double [] list)    {        // initialise instance variables        this.firstname = firstname;        this.lastname = lastname;        this.testscores = testscores;        this.grade = grade;        grade = coursegrade(list); //calc      } 

i tried using in code , solved few of error messages lingering. can explain functionality of ... vs. []

the difference between

public studentdata(string firstname,string lastname,double ... list)

and

public studentdata(string firstname,string lastname,double [] list)

is in latter, caller has instantiate array , give argument. in former, arguments automatically put array. called varargs.