Preparation work:
1. Install extension
2. Configure java path
File in the upper left corner-"Preferences-"Settings Open setting.json
, add java.home
Finally restart Can.
The first java program
1. Create a file named hello.java
2. Write a program, such as:
public class hello{ public static void main(String[] args) { System.out.println("helloworld"); } }
Note: The file name and class name must be consistent.
3. Press F5 to run the program
Output result:
helloworld
The first program is completed!
More related tutorial recommendations: vscode tutorial
The above is the detailed content of How to write the first java program when using vscode for the first time. For more information, please follow other related articles on the PHP Chinese website!