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 Practice Java Arrays!
You have completed Practice Java Arrays!
Preview
Let's see about creating an Array!
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
[MUSIC]
0:00
Now that we've learned about the arrays in
Java, it's time for some more practice.
0:09
In this session, you'll be getting
practice with arrays and for loops.
0:13
Let's look through what you'll need
to do to complete the challenge.
0:17
Attached to this video is a new workspace.
0:21
Inside are a couple files
to help get you started.
0:24
You may recognize Cow.java from
a previous practice session.
0:28
But this practice session is about arrays.
0:32
So let's click over to Arrays.java and
see what we need to do.
0:35
Start by creating an array
of good cow names.
0:39
This should be a string array, and
can be whatever names you'd like.
0:43
After that, create an array of cows that's
the same length as your names' array.
0:47
Next use a for
loop to populate the cows array with
0:53
cows using names from the names' array.
0:57
And finally use an enhanced for
1:01
loop to print the name of each cow
from the cows' array in step two.
1:04
So at the end,
1:09
when we run the program, we should see
a name of each of the cows in the list.
1:10
Also if you don't remember
how to run a program,
1:16
remember that you'll start
by clearing your workspace.
1:19
Then compiling your project.
1:24
And finally,
running it with the java command.
1:32
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