Structure. Labs will typically begin with a brief lecture and/or example to reinforce the material covered in lecture. The class will then have chance to ask questions. After that, there will be a series of exercises for you to complete. You are welcome to work on the exercises on your own or pair up with a classmate.
Attendance:
It is important that you attend the lab for which you are registered on StudentLink. If you need to attend another lab section on any given week, please notify your instructor in advance.
For each lab, you must be checked off by either a teaching fellow or course assistant in order to recieve credit for the lab.
Participation:
To get full credit for participation in lab, you must work productively and submit the work that you complete as specified by the TA. You will not be penalized if you cannot finish all of the lab exercies, but we strongly encourage you to complete the exercises outside of lab, and check your answers with the solutions when posted.
Don’t hesitate to ask for help! The course staff is more than happy to help you with any questions that you may have, and we will be coming around to assist you during lab.
Note
You cannot get credit for completing the lab tasks at home and coming to lab only to sign the attendance sheet. Part of participation is attending the lab to interact and ask questions.
Collaboration.
Using folders
We strongly encourage you to create a separate folder for each lab
and each problem set, so that you can more easily keep track of
your work. For example, you could create a folder called lab1
for your work on this lab, and put all of the files for this lab
in that folder.
In Lab 0, you should have installed your IDE on your computer. If you have not, please do so ASAP.
To see how to use it, let’s take the following steps together:
Let’s begin by creating an easy-to-access general folder on your computer where you can store
all your code throughout the semester. Example: a CS112 general folder
along with several subfolders one for each problem set assignment, lab, and anything
else to keep things organized.
Launch VSCode on your laptop. If you do not see the VSCode icon on your workspace, you can:
on Windows, use the Windows button in the lower-left corner of your Desktop to search
for and run Visual Studio Code.
on macOS, use the Spotlight tool to search for and and run Visual Studio Code.
You should begin on the Welcome page (if not, click on the File dropdown on the top left
and select Close Folder).
If you have not already done so, in your computer’s file explorer, create a folder
called lab1 inside your CS112 folder (organization is up to you).
Select the File->Open Folder or File->Open menu option, and use the resulting dialog box to
find and open the lab1 folder that you created.
The name of the folder should appear in a new Explorer pane on the left-hand side of the VS Code window.
Let’s create our first java file. There are many ways to do this, but for now
we’ll start with the easiest. To the right side on lab1 there should be an icon
labelled “New File”. Select File->New File, which will open up an empty window known
as an editor window for your new program. It will initially have a name that is something like Untitled-1.
Select File->Save, and give the file the name HelloWorld.java.
Now let’s write our first class. Don’t worry if you don’t understand the syntax yet, this is just an introduction. Copy the following code into the file:
public class HelloWorld { public static void main(String[] args) { /* INSERT a line to output "Hello World" */ } }
Replace the comment with the statement to print the literal string “Hello World!”
Save and run the program. There are many ways to this, but the easiest is to hit the Run
button on the top right of the window.
A few useful tips when working with VSC:
A lot of VSCode problems and glitches can be solved by cleaning the workspace.
Click on the Java Projects tab within the Explorer, and select More Actions (the three dots).
Then select Clean Workspace.
If the VSC Terminal is acting up, one option is to kill the terminal and restart it.
In the Terminal tab, there is a trash can icon to the top right side.
Select that to Kill Terminal, then restart it by either running your program again or
selecting New Terminal under the Terminal tab at the top.
Sometimes your files can get long and confusing, and finding methods within your file may get hard. VSCode provides an Outline tab in the Explorer. If you click on it, it will show you a list of locations within your file, and clicking on them will automatically bring you to that location. This can be helpful later on in the course when files get longer.
You have pretty much full customization of your window in VSCode. The most useful may be that you can have multiple files open side by side, allowing for easier access to multiple files simultaneously.
Take some time and mess around with the personalization to make your space to your liking, you’ll be using it a lot throughout the semester. On the Welcome page (you can open it under the Help tab), you can choose a Color Theme. Under the VIew tab up top, there some options under Appearance and Editor Layout that you may like.
Let’s start with a simple exercise to get used to the VSC Development environment.
Download the following file (in your lab1 directory) on your computer.
Open it up using VSC. Now pretend you are the Java compiler and try finding all
the intentional bugs in the program. How many errors can you find?
Fix all the errors and try to run your program. If you fixed all the compilation errors your program should run. If you did not find all the errors, look through the compiler errors to see if you can fix the remaining. Run your program once all the errors are fixed.
Now look at the result. Is it correct? If not, there may be a logic error. Can you find it?
Download Greetings.pdf which contains a specification for the program we would like you to write. For this lab, you do not need to submit your assignment but, you do need to show your program to your TF or TA prior before you leave the lab.
In case you are not able to complete this task or the challenge portion in lab today, it can be a fun weekend activity! Remember lab solutions will be posted!
Last updated on February 3, 2026.