Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Java Arrays!
You have completed Java Arrays!
Preview
Let's explore a handy way to create arrays when you know all the values at creation time.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
First, we have golf scores.
0:00
We know that
we have a fixed number of holes, 18,
0:00
but we don't know what those scores are at
the moment we create the scores array.
0:03
Our other example,
0:08
the friends going to a movie
theater together, is a little different.
0:09
We actually do know who the friends are
at the creation time.
0:13
When you know all the values of an array,
0:17
you really should use
what is known as an array literal.
0:19
It saves a lot of typing,
and it's actually quite concise.
0:22
You're going to love it.
0:25
Let's take a look.
0:26
Go ahead and get your workspace up
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up