EX00 – Hello, World

0. Complete the Prerequisites

Before continuing on, be sure you’ve completed each of the following steps to prepare your computer for the course’s programming assignments. This means installing the required software and setting up the course workspace. Instructions for this can be found here.

1. Download New Course Material

“Pulling” course materials down from Upstream. As new lesson material or starter code for exercises is added to our central course repository, these are the steps you’ll take to download them into your own workspace repository.

  1. Open the Git menu from along the top and select Pull
  2. This downloads the latest course materials! It will succeed silently, so if nothing appears to happen it worked (and any new files will be available in the file explorer). If there was an error, you would see an error message pop up.

2. Write Your First Java Program!

Now for the main attraction! Let’s write a classic “hello world” program.

In IntelliJ, be sure your workspace is open. First, we want to verify that our project structure is correct. You should see a gray exercises folder, with a blue folder titled src inside of it. If the src folder is not blue, right click on it and select “Mark Directory as Sources Root.” You should only have to do this once for the entire summer session.

Next, right click on the src directory and select “New Package.” If you don’t see this option, no worries, we just need to reconfigure some settings in your IDE! Go to File -> Project Structure. A pop-up window will appear and on the left menu select Modules under Project Settings. Individually click on each of the src folders located in your project hierarchy and mark them as sources. Then hit apply and exit.

Name your package ex00. This is where the code for your very first exercise will go.

Now, right click on your ex00 package and select “New Java Class” and name your class HelloWorld. It is important that you name your classes exactly as specified in the write-up. You will be prompted to add this new file to Git. Click “Add.”

At this point, you have all the correct files set up and have the scaffolding of a basic Java class ready for you. Your task for this first exercise is the following:

  1. Add a main method to the HelloWorld class
  2. Print “Hello, World” inside this main method

We go over how to write a main method in class on 6/1 and also how to produce printed output. Once you have a valid main method defined, a green play button will appear in IntelliJ next to its signature. You can click on this to run your program, and see if your code runs as expected!

3. Make a Backup Checkpoint “Commit”

“Push” your work up to GitHub for backup. By creating “commits”, which you can think of as versioned checkpoints in your workspace, you are not at risk of losing your work. It’s easy to revert back to an old version or to restore your entire workspace on a different computer.

  1. Select the Git menu along the top of your screen and then choose “Commit”.
  2. Notice the files listed under Changes. These are files you’ve made modifications to since your last backup.
  3. Ensure all the files that you’d like to backup are selected. Your cursor should be inside of a message box where you will write a nice description of the modifications you’ve made to your code, like “Finished EX01!”, and then hit the “Commit” button.
  4. If you open the Git at the bottom of your screen, you should see this commit added to your chain of git commits. However, it has just been added to your local main branch, and needs to be pushed to your remote backup.
  5. Select the Git menu along the top of your screen again and then choose “Push”.
  6. A pop-up should appear that displays: “main -> backup : main”, which means your latest local commit on the local main branch is going to be pushed to the main branch on the remote backup. If you see “main -> origin : main”, just click where it says origin and select backup. Hit the “Push” button.
  7. If you want to see your backed up work on Github, navigate to the following URL but replace USERNAME with your GitHub username:

4. Submit to Gradescope for Grading

All that’s left now is to hand-in your work on Gradescope for grading!

Before doing so, you need to know that before an assignment’s deadline you can resubmit work as many times as you need to without penalty. Portions of assignments are autograded and will provide near-immediate feedback. We want you to resubmit as many times as it takes you in order to earn full autograding credit!

Login to Gradescope and select the assignment named “EX00 - Hello, world.” You’ll see an area to upload a zip file. To produce a zip file for autograding, return back to IntelliJ.

Mac Users

Along the bottom of your window, you should see an option to open a terminal integrated into IntelliJ.

Type the following command (all on a single line):

./submit.sh ex00

In the file explorer pane, look to find the zip file named “ex00_submission.zip”. If you right click on this file “Open in -> Finder” on Mac, the zip file’s location on your computer will open. Upload this file to Gradescope to submit your work for this exercise.

If you are getting a permission denied error, run chmod +x submit.sh and then try again.

Windows Users

We are working on rewriting the script to work for Windows! Until then, please navigate to your course workspace in a File Explorer window. Then right click on the src folder in your exercises directory and compress the directory into a zip folder. You can name it “ex00_submission.zip”

When you upload it to Gradescope, please delete any files that showed up in the src/ folder that were not actually part of ex00.

Autograding will take a few moments to complete. For this exercise there will be no “human graded” component, but in future exercises and projects there will. Thus, you should expect to score 100 out of 100 possible points on this assignment. If there are issues reported, you are encouraged to try and resolve them and resubmit. If for any reason you aren’t receiving full credit and aren’t sure what to try next, come give us a visit in office hours!