Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Java
  3. Question
Java

What is the significance of ellipses java signature for multiple parameters?

Asked by Amy Avery Oct 10, 2022 1.1K views 1 answer
Share

About this question

Firstly, I am studying function with new type of signature and body, and in this code, I want to know, what type of object is values? It doesn't appear to be an array of strings based on my observation.

Secondly, is there any method that returns the name of the class a particular object is? I thought it might be tostring, but that returned Ljava.lang.String;@1540e19d in the code below. Don't understand this...


static double AddValues(String ... values) {
    double result = 0;
    Object o = values;
    System.out.println("XXXz");
    System.out.println(o.toString());


    for (String value : values)
    {
        double d = Double.parseDouble(value);
        result += d;
    }
    return result;
}


Your answer

1 Answer

More Java discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Java Blogs

Guides, tips and career advice on Java from JanBask experts.