I. Tools and Environment
Install the tool and compile Java, you need to install the JDK, specific Baidu, there are guidelines.
Using software tools: MyEclipse. And, of course, Eclipse, all with MyEclipse, is because it's loaded with Tomcat, it's easy to build a Web server, and it's more friendly for beginners.
Ii. building projects and writing code
1. Create a new Java Project. file-"new-" Java project, then enter the project name, click Finish.
2, just create the project can also choose other things, but I think the first step from the minimalist, we have a HelloWorld program. Build a new project, the second step is to create class, right-click on the new project,
New-"class, then enter the package name and class name, and it's done. For beginners, be aware that the class name and file are consistent. The package name can be in this form: com.test, the simplest function of the package
is to reduce the naming conflict of class, like namespace in C + +, which is discussed in more detail later.
3, good, the project has been built, the class has been built, the following began to show code and interpretation.
The first line of the file indicates which package the class is in, using the keyword packages;
Class Name: HelloWorld, you should know that my file name is Helloworld.class;
The main function, one in a project, and one, and must be a public static description;
System.out.println is the form of the output stream in Java
1 Package com.test; 2 3 Public class HelloWorld {4 5 Public Static void Main (string[] args) {6 System.out.println ("Hello World"); 7 }8 }
Third, save the project and compile
CTRL + S shortcut to save the file, and then we right-click on the project name, Run as-"Java application, you can see our Hello World in the console."
Iv. Summary
Learning every programming language, we are accustomed to using Hello World to start. Simple, but do not forget the first time to write your own Hello World excitement, this step may be a lot of textbooks have, more detailed,
But I also want to record my own hands-on process, programming is made up of artwork.
The first Java program