Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
The Challenge1:39 with Ben Deitch
Let's see about creating an Array!
Now that we've learned about the arrays in Java, it's time for some more practice.
In this session, you'll be getting practice with arrays and for loops.
Let's look through what you'll need to do to complete the challenge.
Attached to this video is a new workspace.
Inside are a couple files to help get you started.
You may recognize Cow.java from a previous practice session.
But this practice session is about arrays.
So let's click over to Arrays.java and see what we need to do.
Start by creating an array of good cow names.
This should be a string array, and can be whatever names you'd like.
After that, create an array of cows that's the same length as your names' array.
Next use a for loop to populate the cows array with
cows using names from the names' array.
And finally use an enhanced for
loop to print the name of each cow from the cows' array in step two.
So at the end,
when we run the program, we should see a name of each of the cows in the list.
Also if you don't remember how to run a program,
remember that you'll start by clearing your workspace.
Then compiling your project.
And finally, running it with the java command.
You need to sign up for Treehouse in order to download course files.Sign up