7.2. Setting up the Environment¶
Learn by Experimenting!
For each of the remaining sections in this chapter, be sure to login to Odin and type out the commands given in each part, taking notes as needed. When you are done, you will have a step-by-step outline for creating and using interfaces in Java. Your notes and will be very useful on upcoming homework assignments and projects. The steps in this tutorial assume that you are logged into the Odin server.
As you work through this chapter, you will write code to properly utilize inheritance in Java using two separate examples.
On Odin, complete each of the following steps:
Use the following command to download and execute a shell script that retrieves the starter code for this tutorial and places it into a subdirectory called
cs1302-inheritance
:curl -s -L https://raw.githubusercontent.com/cs1302uga/cs1302-tutorials/master/inheritance/setup.sh | bash
Change into the
cs1302-inheritance
directory that was just created and look around. There are two separate folders pertaining to the two examples we will work through in this chapter (animal
andperson
). Take a minute to run thetree
command on each of these subdirectories and notice that each one has a separatesrc
folder containing the source code for that example. You can also runtree
on both subdirectories to see their contents simultaneously using this command:tree person animal
You should see output similar to the following:
Each subdirectory within
cs1302-inheritance
plays a role in the example. Here is a breakdown of the different subdirectories and their roles:person
the top level directory for the person inheritance example.animal
the top level directory for the animal inheritance example.animal/src
is the default (no-name) package directory for our source code for the animal example.person/src
is the default (no-name) package directory for our source code for the person example.cs1302
,animal
, andidentity
are the named package directories for each example.The three
.java
files under each directory are the starter code for that example.
We will work through each of these two examples in the remaining sections of this chapter.