How 1java works?
eclipse comes to be understood that compiler generates byte code files to the computer can understand.
That file name suffix .class executes bytecode by the Java Virtual Machine (JVM).
2 class analysis
We have successfully run the first program, the interior of this program is what look like?
// disclosed class declaration of the class name of the class left bracket public class MyFirstApp { // disclosed without subsequent stresses Returns the name of parameter passing, a left parenthesis follow some method of public static void main (String [] args) { // printed to standard output to enter a character string, means must be enclosed in double quotes semicolon System.out.println ( "I want to eat breakfast friends" ); } // main () of the right bracket } // right parenthesis class
.Java extension of the source file, with the class definition.
Class is used to represent a component of the program, to be content class inside {}.
main () is the starting point of the program, the program is running, it will first find it.
You may have more than one program or method.
SUMMARY prepared by the statements, in the write belongs to {} in the method.
Statement ends with a semicolon.
// the new Class files, automatically generated with a defined class public class the HelloWorld { // main () method of the master, the starting point of the program public static void main (String [] args) { // output statements may be double quotes the contents of the input System.out.println ( "I taught myself" ); } }
3 error
When the code is entered incorrectly, the Eclipse error message appears
Figure 3 errors appeared in front of each error line number will prompt
3 errors are:
Class is not defined, that is different from the source file name and the name of the class defined in
Statement does not end with a semicolon
The lack of a defined class corresponding brace}
Originally I think missing is the main () method corresponds to the main brackets, after carefully observed
The remaining brackets automatically become it, no matter where the location, it's missing is a kind of right parenthesis
When an error occurs, move the cursor to the wrong place, there will be a related note, we can modify the prompts.
Problems encountered early learning a skill is very universal, problems can be modified according to the relevant information, very simple.
I found more practice, and more error correction, growth will be faster.