Hello World with VS Code!

This article is a VS Code built with What is Java and Development Environment It actually runs the program.

VS Code execution confirmation

Please describe as follows in practice.java created earlier.

practice.java


class Main {
  public static void main(String[] args) {
    String msg = "Hello World!";
    System.out.println(msg);
  }
}
スクリーンショット_2020-05-12_15_01_06.png

In that state, click "Run and Debug". スクリーンショット_2020-05-12_15_01_21.png

As a result, if the terminal frame is displayed below and Hello World! Is displayed, it is OK. スクリーンショット_2020-05-12_15_14_22.png

VS Code function introduction

From here, I will write the functions that can actually be used with VS Code.

Syntax error

If you remove the; (semicolon) in VS Code's "Hello World!";, A wavy line will appear. This means that an error will occur because it violates the syntax (the rule to write this). The details of the error are displayed in PROBLEMS below. スクリーンショット_2020-05-14_9_24_53.png

Debugging features

Start with the; restored. Place the cursor to the left of the number that represents the number of lines in the program and you will see a light red circle. スクリーンショット_2020-05-14_9_55_44.png Click this red circle to darken it. This time, I clicked two places on the 3rd and 4th lines. スクリーンショット_2020-05-14_10_03_03.png

If you debug in this state, the display will change. There are three points I would like you to see. スクリーンショット_2020-05-14_10_02_49.png

① Debug button

This button can be used when debugging. The following is an explanation. スクリーンショット_2020-05-14_10_39_44.png

  1. Move: Move the position of the button group by dragging.
  2. Continue: Continue running the interrupted program
  3. Step over: Run the current line and stop at the next line
  4. Step-in: Execute the current line and stop execution at the next line. If the line is a function / method call, rush into the function / method and stop execution
  5. Step out: Continue stepping until the currently executing function / method ends
  6. Reboot: Debug again
  7. Stop: End debugging
  8. Hot code execution: It is said that the modified code can be executed as it is, but it was omitted because it did not work well.
② Variable

The edit is output here.

③ Breakpoint state

This yellow frame is the line that is currently being read (= not currently). It will stop as many as the number of red circles.

Variable confirmation

If you press the continue button, it will stop at the next breakpoint. At that time, you can confirm that Hello World is performed in the variable msg. スクリーンショット_2020-05-14_11_03_47.png In this way, you can check the status by using breakpoints. We have prepared two breakpoints this time, but you can also prepare one and use the 3. Stepover button to see each line.

Recommended Posts

Hello World with VS Code!
Lombok with VS Code
Hello World on Mac VS Code Java
Hello World with Micronaut
Until you run Hello World of JavaFX with VS Code + Gradle
Docker management with VS Code
Hello World with Spring Boot!
Format Ruby with VS Code
Hello World with Spring Boot
Hello World with SpringBoot / Gradle
Hello, World! With Asakusa Framework!
Spring Boot programming with VS Code
Until "Hello World" with Spring Boot
Hello World with Docker and C
Java build with mac vs code
(Intellij) Hello World with Spring Boot
Hello World with GlassFish 5.1 + Servlet + JSP
Create PDF with itext7 ~ Hello World ~
Getting Started with Docker with VS Code
"Hello world" for ImageJ with Eclipse
Hello World with GWT 2.8.2 and Maven
Prepare Java development environment with VS Code
Hello World with Eclipse + Spring Boot + Maven
Hello world with Java template engine Thymeleaf
Read "Hello world"
Try using Spring Boot with VS Code
Java, Hello, world!
Java development with Codenvy: Hello World! Run
"Hello, World!" With Kotlin + CLI in 5 minutes
Java Hello World
Hello world with Kotlin and Tornado FX
How Spring Security works with Hello World
(IntelliJ + gradle) Hello World with Spring Boot
Spring5 MVC Web App Development with Visual Studio Code Hello World Creation
Spring Boot2 Web application development with Visual Studio Code Hello World creation
Hello world! With Spring Boot (Marven + text editor)
Hello World at explosive speed with Spring Initializr! !! !!
Run JSP Hello World with Tomcat on Docker
Using Gradle with VS Code, build Java → run
[Java] Hello World with Java 14 x Spring Boot 2.3 x JUnit 5 ~
Show a simple Hello World with SpringBoot + IntelliJ
Try to display hello world with spring + gradle
Create Spring Boot environment with Windows + VS Code
Try debugging a Java program with VS Code
Easy to display hello world with Rails + Docker
Build a Java development environment with VS Code
"Hello World" in Java
Java Learning (1)-Hello World
Read System.out.println ("hello, world")
Let's write Hello World
Hello world in node.js
Hello World in Java
Studying Java-Part 1-Hello World
Hello World on WebAssembly
Hello World (REST API) with Apache Camel + Spring Boot 2
Build ruby debug environment with VS Code of Windows 10
Introduce JavaFX 15 and do GUI development with VS Code
Build Java development environment with WSL2 Docker VS Code
How to build Java development environment with VS Code
[Environment construction] Build a Java development environment with VS Code!
Beginners create Spring Tools Suite environment with VS Code