I am new to Java, coming mainly from C++ & JS, and I am just experimenting trying to learn the differences and what not and I came across something unusual. I am trying to pass an array of doubles into a constructor method, but the way I was trying would not work. The method signature for the ctor is
public Student(int sid, String name, double [] grades)
The way I was trying to pass the array was
Student s1 = new Student(1, "Mike", [99.9,88.8]);
however the only way i could get it to work was by creating an array
double[] grade = {99.9,88.9}
and passing that to the ctor like Student s1 = new Student(1, "Mike", grade)
So my question is, is it possible to do it the way i first tried
Student s1 = new Student(1, "Mike", [99.9,88.8]);
or something similar?
Thank you.
@ernest_k did you even read my question before closing it? the thread you linked was a completely different issue.