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-inheritancedirectory that was just created and look around. There are two separate folders pertaining to the two examples we will work through in this chapter (animalandperson). Take a minute to run thetreecommand on each of these subdirectories and notice that each one has a separatesrcfolder containing the source code for that example. You can also runtreeon 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-inheritanceplays a role in the example. Here is a breakdown of the different subdirectories and their roles:personthe top level directory for the person inheritance example.animalthe top level directory for the animal inheritance example.animal/srcis the default (no-name) package directory for our source code for the animal example.person/srcis the default (no-name) package directory for our source code for the person example.cs1302,animal, andidentityare the named package directories for each example.The three
.javafiles 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.