This module illustrates how to install the core tools and workflow used throughout CS 231: Java, the command line, and Visual Studio Code.
Complete each task in order. Ask questions as you go.
Notes:
Verify the installation:
java -version
You should see output similar to:
javac 25.0.1
We will configure VS Code further in later labs. For now, a default installation is sufficient.
Lab1Lab1 folder onto the VS Code windowLab1.javaCreate a public class whose name matches the file name:
public class Lab1 {
}
Add the program entry point:
public static void main(String[] args) {
}
Add a print statement:
System.out.println("Hello, World!");
Compile and run your program:
cmd/ctrl + j)ls
You should see:
Lab1.java
javac Lab1.java
List files again:
ls
You should now see:
Lab1.class
Lab1.java
Run the program:
java Lab1
You should see:
Hello, World!
Congratulations! You have written, compiled, and executed your first Java program. Don't worry if not all the syntax makes sense right now. It will be second nature in a couple of days.