10.3. Setting up the Environment¶
Learn by Experimenting!
For each of the remaining sections in this chapter, be sure to log in 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 will be very useful for 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 generics in Java.
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-generic-classes:
curl -s -L https://git.io/Je3Dh | bash
Change into the
cs1302-generic-classes
directory that was just created and look around. There should be multiple Java files contained within the directory structure. To see a listing of all of the source code files, use thetree
command as follows:tree src
You should see output similar to the following:
Each subdirectory and file within
cs1302-generic-classes
plays a role in the example. Here is a breakdown of these roles:src
is the default (no-name) package directory for our source code for the shipping container example.cs1302
andgenerics
are the named package directories for each example.The
Camera.java
andDrone.java
files correspond to the UML Class Diagrams you saw in the chapter introduction.The
Driver.java
file contains amain
method and will be used to test some code related to generics.