CS116      Lab 0 - Introduction to Java

Objectives:

  1. Before starting this lab you should have read Chapter 2 in your text.
     
  2. Open Eclipse.  In the Window menu, select Open Perspective and then Other. From the choices provided, select DrJava. You should now see a Package explorer on the left which when opened contains all the Java classes that we will need this semester.  On the bottom, you have an Interactions Pane in which you can type Java statements. 
     
  3. Under the Window menu select Preferences.  Open the Java selection and click on the Building option.  You should see a page with a check box labeled "Scrub output folders when cleaning projects". 
    IMPORTANT:  Make sure that box is UNCHECKED.
     
  4. Open a browser and go to the class web site http://phoenix.goucher.edu/~jillz/cs116/  .  Right click on the file cs116.zip and save that file on your G: drive.  Open that file in WinZip and Extract the contents to your G: drive. 
    IMPORTANT:  Don't place the extracted folder on your desktop or in your My Documents folder.  It should be directly on G:
     
  5. Save and unzip the mediasources files on your G: drive.
     
  6. In Eclipse, from the File menu select Import.  Select General and then "Existing Projects into Workspace" from the choices provided. Browse to your G: root directory and select the cs116 folder. Click OK.  You should be offered a selection of a project named cs116.  Click Finish.
     
  7. In the Interactions pane, type in each of the following sequences of Java expressions and statements to see what they do.  Note: You should “Reset Interactions” after each sequence by pulling down the menu from the upside down triangle in the upper right of the Interactions pane.
     

  8. The Interactions Pane is great for testing out code and we will be using it a lot.  But we will also want to be able to have a Java class that forms a program application that can be executed on its own.  From the Package Explorer select the class MyProgram. This class has a "main" method that is executed when we execute the class.   You can execute this program by selecting Run As under the Run menu (or the Run icon in the toolbar) and then choosing Java Application.  The output of the program will appear in the Interactions Pane.
     


  9.  

    Assignment:
    Edit the code in MyProgram so that it prints out your name.

     


     

  10. Email your modified code MyProgram.java to me at jill.zimmerman@goucher.edu