Home  >  Article  >  Development Tools  >  How to write the first java program when using vscode for the first time

How to write the first java program when using vscode for the first time

王林
王林Original
2019-12-06 09:34:208605browse

How to write the first java program when using vscode for the first time

Preparation work:

1. Install extension

How to write the first java program when using vscode for the first time

2. Configure java path

File in the upper left corner-"Preferences-"Settings Open setting.json, add java.home

How to write the first java program when using vscode for the first time

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn