- Review the previous article
- The last article is basically theoretical classes, although uninteresting, but for us to further study is very helpful, because for learning we not only have to know it, but also to know why
- Below we will learn how to write the first Hellworld program (the first program in all programming languages, starting with the HelloWorld program)
- Writing and running the HelloWorld program
- Develop with Notepad (note more details)
- Create a HelloWorld.txt text file on the desktop
- double-click to open, enter the following
public class helloworld{
public static void Main (String [] args) {
System.out.println ("Hello, HelloWorld");
}
}
- after saving, modify the file suffix ". txt" to ". Java"
-
Then open the Console window application
1) Enter the command CD desktop enter the desktop path
2) Enter the instruction Javac Hel Loworld.java Enter the desktop generates a Helloworld.class file
1.
3) Input instruction Java HelloWorld Enter to see console output Hello, HelloWorld content, indicating that the program is running correctly
1.
-
Description
1) Output of the Chinese garbled, what to do?
2) when the source file (. Java is the source file) has been modified, it will need to be recompiled to take effect
3) If you enter the javac instruction, the hint "' javac ' is not recognized as an internal or external command , operable program or batch file.
1. It cannot act as an internal instruction, external instruction, operation program, or batch file
2. Need to be configured in a system environment
I)
- Using Eclipse development (a lot less professional tools)
-
Simple use of Eclipse tools
1)
-
Specific steps
1) in the empty space of the package resource view, right->new >java Project
1.
2) The project name is: HELLOWORLD_R1, then click Finsh
1.
3) Locate the project you created, select Src, and then right-click >new>class
1.
4) name named: HELLOWORLD_R1, check public static void Main (String [] args) method
1.
5) write the source code: write in the Main method: System.out.println ("Hello HelloWorld");
6) Run the program, the console can output the results
1.
-
Description
1) using tools, a lot of features, what we have to do is to know where these functions are and how to use them
2) The class name is named according to need, not necessarily the same project name, more naming rules are summarized later
3) How to set the font type in source code
1.
2. The first Java hellorworld! thread