Choose the basic course of Java, fast mid-term exam, summed up the knowledge point, mainly is not or unfamiliar with their knowledge.
First, the Java compilation and the operation process here reference: http://www.360doc.com/content/15/1008/16/28141597_504191402.shtml
The Java program is created from the source file to the program to run through two major steps: 1, the source file is compiled by the compiler into bytecode (bytecode) 2, the bytecode is run by the Java Virtual machine interpretation.
first Step (compile): After the source file is created, the program is first compiled into a. class file. When Java compiles a class, if the class depends on the classes that have not been compiled, the compiler compiles the dependent class and then references it, otherwise it directly references it.
Two steps (Run): Java class running process can be divided into two procedures: 1, class loading 2, class execution. It is important to note that the JVM will not load the class until the first time the program has actively used the class. That is, the JVM does not load a program into memory in the first place, but loads it only once when it has to be used.
Take this code as an example:
- Mainapp.java
- public class Mainapp {
- public static void Main (string[] args) {
- Animal Animal = new Animal ("Puppy");
- Animal.printname ();
- }
- }
- Animal.java
- public class Animal {
- public String name;
- Public Animal (String name) {
- THIS.name = name;
- }
- public void Printname () {
- System.out.println ("Animal [" +name+ "]");
- }
- }
- After compiling the Java program to get the Mainapp.class file, tap Java appmain on the command line. The system starts a JVM process, and the JVM process finds a binary file named Appmain.class from the classpath path and loads the Mainapp class information into the method area of the runtime data area, a process called Mainapp class loading.
- The JVM then finds the main function entry for Appmain and begins executing the main function.
- The first command of the main function is animal animal = new Animal ("Puppy"), which is to have the JVM create a Animal object, but this time there is no information about the animal class in the method area, so the JVM immediately loads the animal class, Put the type information of the animal class into the method area.
- After loading the animal class, the first thing the Java Virtual machine does is allocate memory for a new animal instance in the heap area, and then call the constructor to initialize the animal instance. This animal instance holds a reference to the type information for the animal class of the method area, which contains the method table, the underlying implementation of the Java dynamic binding.
- When using Animal.printname (), the JVM finds the animal object based on the animal reference and then navigates to the method table for the type information of the animal class in the method area based on the reference held by the animal object, obtaining Printname () The address of the byte code of the function.
- Start running the Printname () function.
Second, the important abbreviation:
Api:application Programming Interface
Third, note:
/** documentation (file) **/
Iv. Inheritance:
Basic Java Knowledge