Java from entry to abandon 1

Today, I finally aimed at Java. I want to start with the young man Java, hehe. This is the beginning of the enjoyable and exciting Java journey.
Don't say much, do it first! ! Old rules, code! If you have a friend who has not configured java, you can refer to my article: Java Installation .
I first create a Hello.java file in the Java demo directory, as shown below:
Insert picture description here
Then edit the Hello.java file, the content is as follows:
Insert picture description here
Define a class, the class name must be consistent with the java file name, and write a main function (method) in it As the entry point for program execution, every Java program must have a main function (method). Finally, print out the content.

Press Ctrl+S to save and then exit.

Next, we open the command line to compile the Hello.java file, we enter the Hello.java directory, and then use the command to javac Hello.javacompile. The result is as follows:
Insert picture description here
At this time, we found that there is an extra Hello.class file, which is a binary file generated after compilation, and the content inside is a binary code that the machine can understand. As shown in the figure below:
Insert picture description here
Next, we run the Hello program, command:, java Helloand the result is as follows:
Insert picture description here
Good job! ! Daily report errors for Chinese characters! ! It's awkward before getting out of school! ! This seems to have to be decoded and run in IDE or IDEA.

Then, I use Eclipse directly, I have set up the JDK environment, open the directory corresponding to the Hello.java file, and then run the Hello.java file, as shown in the figure below:
Insert picture description here
The first time I contact Java today, I will share it with you. Finally, thank you all for coming to watch my article. There may be many improprieties in the article, and I hope to point out He Haihan.

Guess you like

Origin blog.csdn.net/weixin_43408020/article/details/113901903