On your laptop, create a folder for your work in this course by following these instructions.
Within your cs460
folder, create a
subfolder called lab0
for the program
that you are about to create.
Launch VS Code on your laptop:
On Windows, use the Windows button in the Taskbar to search for and run Visual Studio Code.
On macOS, use the Spotlight tool to search for and and run Visual Studio Code.
In VS Code, select the File->Open Folder or File->Open menu
option, and use the resulting dialog box to find and open the
lab0
folder that you created in step 2. The name of the folder
should appear in a new Explorer pane on the left-hand side of
the VS Code window.
Select File->New Text 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 following name:
HelloWorld.java
Important: Don’t forget to use the exact combination of upper-case and lower-case letters that we have specified.
Copy and paste the following code into the editor window for
HelloWorld.java
:
public class HelloWorld { public static void main(String[] args) { System.out.println("hello, world!"); } }
To run the program, use the F5 key. Doing so should open a Terminal pane at the bottom of the VS Code window. In the Terminal, you should see (among other messages) the output of your program:
hello, world!
Note: If pressing F5 does not immediately work, find the
name HelloWorld.java
in the Explorer pane, right click on the
name HelloWorld.java
, and choose Run
or Run Java
to run the
program.
If you encounter any problems in getting the program to run, please
let us know by posting a question on Piazza or emailing
cs460-staff@cs.bu.edu
Last updated on September 15, 2024.