This article is a VS Code built with What is Java and Development Environment It actually runs the program.
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);
}
}
In that state, click "Run and Debug".
As a result, if the terminal frame is displayed below and Hello World! Is displayed, it is OK.
From here, I will write the functions that can actually be used with VS Code.
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.
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. Click this red circle to darken it. This time, I clicked two places on the 3rd and 4th lines.
If you debug in this state, the display will change. There are three points I would like you to see.
This button can be used when debugging. The following is an explanation.
The edit is output here.
This yellow frame is the line that is currently being read (= not currently). It will stop as many as the number of red circles.
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. 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