Java 0 Basics Run the first program
An overview of 1 JavaCode compilation
Post-compilation talent is performed on the computer. Compiling is the conversion of code that people can read into a form that the machine can understand.
2 Javathe Strengths
Compile once. Executed everywhere. Because Java code is executed in a virtual machine, the virtual machine eliminates differences between different operating systems. Java Virtual Machine--- abbreviation JVM
3 Javathe version number
SUN Company announced Java1.2 later, called the Java called java2 , so now is called j2xx .
The feature is divided into three version numbers:
J2SE Standard Edition ---- Most of today's development uses it
Java EE Enterprise Edition ---- features the most, is j2se 's extended version
The J2ME mini-board ---- has only part of the J2SE function for embedded systems.
But not for Android Systems
And also. Android Development has a version number of its own. Does not belong to one of the above no matter what version number.
4 JavaDevelopment Environment Construction
Install the JDK and development tools address :
Http://www.oracle.com/technetwork/java/javase/downloads/index.html
Download the Netbeans with JDK directly. Will install the IDE and the JDK version j2se .
5Make up a little program to play
1) Executing netbeans
2) Menu -- new
3) The following dialog box appears
SelectJava applicationand click Next.
4) The following content appears
The project name changes to Helloand the rest changes. Point is complete.
5) Open source code files, such as
Add code to the main function
It means the output string "Hello"
( yes.) Not "Hello world!". Obsessive Compulsive disorder go to it )
6) Select Menu Execution -- compile file
A new directory buildis generated at the root of the project, and subdirectories in the classes directory include the compiled files. Can see that Hello.java was compiled into a hello.class.
Can't find the path where the project is located ?
Put the mouse on the Tab Control (arrow), a prompt box appears, and the red line indicates the root directory of your project.
7) Point Execution button
Occurrences such as the following result:
Can't you see that ? you still have to stop learning this line ...
8) Explain this code
Package Hello pack name. The source code file must be placed in a package.
public class Hello declares a class. The content of the class is something in {} .
Public static void Main (string[] args) defines a method (or function). The method is called main. The main method is in a method, andtheJava program starts with the main function
System.out.println ("Hello"); Call a method, which is taken in the Java SDK , meaning to output a string "Hello" in the output form.
Java 0 Basics Run the first program