Java study notes (2020/2/17)
Procedure 1. Program execution:
A.java - [the javac] - A.class (bytecode composition) - [JVM] - the results.
2. Each Java program containing at least one class and main () function, but each application with only a main () function.
3.java program into applications and applets , ** applet is no main () *, which is loaded by other programs running, for example, IE and the like. So "Java source code is defined by a class composed of each program is only one class is the main class, the main category refers to class contains the main method." This view is too one-sided, wrong
4. The difference between applications and applets are:
1, different operating environment **: ** small application can only run on Java-compatible container, can be embedded within an HTML page, published on the web, when the web page is while browsing, running in a browser. Run applets also subject to strict security restrictions, for example, it can not access files on a user's computer. Java application does not have these limitations, does not support embedded Web page and download and run.
2, a different style of code **: ** a applet must be defined as a subclass of the Applet class, the application may be a subclass of the Applet class, it may not be. Application in a class must define a main () method, which represents the application entry. And applets not define the main () method, which is performed by a plurality of methods defined in the Applet class control .
5.Java the boolean and integer not compatible, can not be used directly as an int value determination logic
6.JAVA program structure:
source files - "" class - "" approach - "" statement
7. When the design categories: two parts
of the object itself known thing is called: instance variables (instance variable)
operation of an object can perform: Method (class)
8. understood classes and objects
9. All programs at least have a main () method, because to find the java virtual machine is running Interface is the main () method.
10. The set environment variables:
path: the JDK's bin (package execution) path in the path
classpath: New --JDK / lib folder
javac: compiler
java: the program runs
11. Note that the number of points:
First, the data from the high precision and low precision required to cast .
Second, with a constant final modification (c in: const), as in the program value it can not be modified .
Third, there is static modification of class variables , not instance variables.
Fourth, the "==" and "the equals ()" difference:
"==" Analyzing the same address
identical "the equals ()" determines the value of
five, : main class Java
class name and file same names , and containing main () class function .
Sixth, any variable just add public, static, final will basically become global variables.
12. IMPORTANT:
12.Java virtual machine specification defines:
a set of instructions, the register set, the structure of the class file, stack, garbage collection heap memory area
13.JRE(The Java Runtime Enviroment)
JRE = JVM +API(lib)
JDK=JRE+TOOLS