search
HomeDevelopment ToolsVSCodeHow 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

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
Why is VS Code using so much CPU?Why is VS Code using so much CPU?Jul 24, 2025 am 02:43 AM

VSCode's high CPU usage problem can be solved in the following ways: 1. There are too many plug-ins or the quality is not high. It is recommended to disable infrequently used plug-ins and view running extensions; 2. Large projects consume a lot of loading, so directories that do not need to be listened to can be excluded in settings.json; 3. Search and Git functions are frequently triggered, so you should avoid using complex search options and turn off unnecessary Git automatic refresh; 4. Problems with the editor themselves can try to update, reinstall or clear cache to optimize performance.

How to configure tasks.json in VSCode?How to configure tasks.json in VSCode?Jul 24, 2025 am 02:42 AM

To configure VSCode's tasks.json file, you only need to master the basic structure and fields to get started. 1. Create a tasks.json file to generate a template through the VSCode menu "Terminal>Run Tasks>Create tasks.json file". 2. The infrastructure includes version and tasks arrays, and each task includes label (task name), command (execution command), args (parameters), type (execution environment), and problemMatcher (error identification). 3. Common uses such as running npm scripts, you can configure command to npm and args to ["run",&q

How to turn on word wrap in vscode settings?How to turn on word wrap in vscode settings?Jul 24, 2025 am 02:33 AM

The method to enable the automatic line wrap function in VSCode is as follows: 1. Click the word "Wrap" in the status bar in the lower left corner to quickly switch; 2. Enter Settings through the menu to search for wordwrap and check "Editor:WordWrap" or set to on; 3. You can select different line wrap modes such as off, on, wordWrapColumn or bounded; 4. Turn off automatic line wrap for specific file types such as Markdown settings; 5. Directly modify the settings.json file to add corresponding configuration to achieve global or personalized settings.

Is VS Code free to use, even for commercial purposes?Is VS Code free to use, even for commercial purposes?Jul 24, 2025 am 02:19 AM

Yes, VSCode is completely free and includes commercial use. It is developed by Microsoft and published using a MIT license, allowing users to use, install, modify and distribute freely without paying fees or worrying about authorization restrictions; specifically: 1. It can be installed and used on any device, without time limit or feature payment wall; 2. Commercial users do not need to give back to projects or disclose usage; 3. There is no official paid version or advanced features, and all tools such as debugger and Git integration are available for free; 4. Third-party extensions may include paid functions, but are not officially provided; 5. Users can modify and redistribute VSCode, but must comply with license requirements and retain original copyright information; 6. If used in the enterprise environment, the legal team is advised to confirm compliance; for the vast majority of users

How to enable format on save in VSCode?How to enable format on save in VSCode?Jul 24, 2025 am 02:17 AM

The methods to enable the "Save Format" function of VSCode are as follows: 1. Install appropriate formatting tools, such as Prettier or Black; 2. Turn on the "Save Format" option through the setting interface or modifying settings.json; 3. Set the default formatting tools to avoid conflicts; 4. Pay attention to common problems, such as checking tool installation, default settings and file type support when it is not effective. Ensure that the above steps are executed correctly, you can automatically format the code when saving files, improving development efficiency and readability.

Where are VSCode user settings located?Where are VSCode user settings located?Jul 24, 2025 am 02:02 AM

VSCode user settings storage location depends on the operating system and is usually located in a specific directory under the user profile. The Windows path is C:\Users$$username]\\AppData\\Roaming\\Code\\User\\settings.json, macOS is /Users\$$username]/Library/ApplicationSupport/Code/User/settings.json, Linux is /home$$username]/.config/Code/User/settings.jso

How to open VSCode settings JSON?How to open VSCode settings JSON?Jul 24, 2025 am 01:31 AM

To directly edit the VSCode settings file, the easiest way is to enter "Preferences:OpenUserSettings(JSON)" through the command panel; in addition, you can also select to open user or workspace settings through the gear icon in the lower right corner → "Settings" → three dot buttons. The user setting path is: Windows: %APPDATA%\Code\User\settings.json; macOS: $HOME/Library/ApplicationSupport/Code/User/settings.json; Linux: $HOME/.config/Code

How to expand selection shortcut VS CodeHow to expand selection shortcut VS CodeJul 24, 2025 am 01:19 AM

The most common method to quickly expand selections in VSCode is to use the shortcut keys Shift Alt right arrow (Windows/Linux) or Shift Option right arrow (Mac), which will expand the selection range layer by layer according to the syntax structure; 1. This function can intelligently select code structures, such as variable names, expressions, statement blocks, etc.; 2. Support multi-cursor operations, and can perform expansion selections at multiple locations at the same time, which is convenient for batch modification; 3. Double-click or triple-click on the mouse can also achieve similar effects, and fine-tuning of the arrow keys can improve efficiency.

See all articles

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.