Java Core Technology Volume I - Chapter 2 Java Programming Environment

2.1 Install Java Development Kit (*)

2.2 Using command line tools

Open a terminal window, enter the Java bin directory, and type the following command:

javac Welcome.java
java Welcome

​ The first line of command means using the compiler javac to compile the "Welcome.java" file, which will get the "Welcome.class" bytecode file; the second line uses the interpreter java to run the "Welcome.class" file.

2.3 Use integrated development environment (*)

2.4 JShell

​ Run JShell and enter the following command in the terminal window, as shown in Figure 2.1.

image-20230923213925381
Figure 2.1 JShell command example

​ Type the expression in the first line "Core Java".length(), and JShell will automatically print the value of the entered expression. $1 here means that the calculation result 9 is stored in $1, which can be used directly for the next calculation, as shown in the second line.

The third line demonstrates the need to use a variable multiple times, specify the type, and then specify the variable name, just like using Java syntax.

The fourth line of command shows the feature of "tab completion". First type Math., press tab and all options will pop up. Continue typing l, press tab to get the completion method log, and then you can manually fill in the rest of the code.

Guess you like

Origin blog.csdn.net/zheliku/article/details/133219196