Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialLisa Schork
9,032 PointsSet the first double in the array to 2.2
just not getting this... I understand I need to include the index number between the brackets, but keep trying the different brackets to make this work and just not understanding this
double[2.2] lapTimes[] = new double[4] lapTimes[2.2];
1 Answer
Steve Agusta
6,221 PointsIt looks like you've got the concept of declaring the array, but the syntax for the declaration and initialization are not quite right. let's look at the array declaration first. How would you write that on its own, to declare an array of doubles with a length of 4?
Lisa Schork
9,032 PointsLisa Schork
9,032 Pointsdouble[] lapTimes = new double[4]; lapTimes[0] = 2.2;
Thanks Steve for the help!!