1.JAVA Virtual Machine
2. Garbage collection
3. Code Security
The Java language is interpreted to execute in a sense that the Java file is compiled (from the source file to the class file process)
The Java target code becomes the bytecode stored in the. class file is a binary code that does not depend on the hardware platform of the machine
Installation of the 1.JAVA development environment
2.JAVA Application (first program to print Hello world on screen)
Run a Java program by typing the following command on the command line
$ Java Program name "parameter list"
If more than one parameter is separated by a space
public static void Main (String args[])
Description of the keyword
Public indicates that main () is a publicly-owned method
The static compiler main () method is statically
String args[] Arguments to hold the command line
3. Compilation and operation of the program
Need to use two tools
1. Compiler Javac
2. Interpreter Java
Error 1:
Now write the first program according to the book (Hello World)
found that follow the steps to find the compilation is not a problem, run the time will appear java.lang.ClassNotFoundException: such errors
Online help Baidu found the need to re-environment variables in the Class_path added./Current path to solve, took a little time
Error 2:
Hierarchy error A. Java source file can contain three top-level elements, these three elements are:
- A package description, package statement, packet description optional
- Any number of incoming statements, that is, the import statement
- Class and interface descriptions
These statements appear in a certain order before a statement is introduced, before a statement is introduced before the class and interface
As a whole, the structure of the Java program is as follows:
- Package Statement 0 or one must be placed at the beginning of the file
- Import Statement 0 or more must be placed before all class definitions
- public class definition: 0 or 1
- Class Definition: 0 or more
- Definition of interface: 0 or more
- Each source file, at least one class, can have at most one public class, when the source file name, if the file contains the public class, the source file must be consistent with the class name
The above content comes from <java programming Fourth Edition > Sin Lia Yimei
JAVA Getting Started Learning (overview)