Concepts and naming conventions for identifiers
Java Constants---Immutable variables
Process of program execution
From now on, you should remember that the memory is divided into four blocks, code Segment,data segment,stack,heap, the actual execution of the time, the codes are first placed in the segment, the virtual machine found the relevant Main method, Then the execution of the crackling is started, and in the course of execution, the other three areas of memory are involved. Because the memory needs to be allocated in different areas when executing.
Java variables
The variables in 1,java are the smallest storage units in the program, and their features include variable names, variable types, and scopes.
Each variable in the 2,java program belongs to a specific data type, which must be declared before being used and then assigned.
Scope of Java variables
Any variable declared in curly braces, the curly brace is no one knows it. (why not say methods and classes, because in the IF statement and the Loop statement, no one knows it).
Classification of Java variables
Note: The parameters of the method are local variables
Partitioning of Java data types
The basic data types include four classes of eight, depending on the size of the space occupied in memory, the same size may also be different in memory layout (0101 of the arrangement is different);
char type;
The Java characters are Unicode encoded and each character takes two bytes, so you can use a 16-Encoding representation (encoding problem: whatever is in the computer is represented by 0101, each 0 is called a bit (bit), a byte is 8 bits, All the text can be used 0101, but different text may account for the number of 0101, a byte can represent a maximum of 2^8 characters, so not Chinese,Unicode includes all the languages of the world.
Integer type;
There are no unsigned integers in Java, all integers are signed bits, so the int type is -2^7-2^7-1.
Floating-point types
The inside of the computer indicates that the floating-point number is error, and the situation is complicated.
Basic Data type Conversions
The character type is also a number inside the computer, so it can also be computed,
Long a = 123;//is equivalent to converting an int type to a long type;
Float a = 12.3;//is equivalent to converting a double to float, which requires the addition of a cast negative character;
Long L = 3000000000000;//must be plus L,3000000000000 is out of range of int type;
int type four bytes, in order to convert to a byte type, the three bytes are cut off, the remaining bytes are a few or several, but double conversion to float no, the computer has a special place to represent the decimal point, directly cut off the internal format is not right.
The float type is converted to a long type, which cuts down the number of decimal parts directly.
Operator
int i = j + +, first assignment and then operation;
int i = ++J; First operation is assigned;
Trinocular: (boolean expression)? Y:z;
Java Basics-Learning summary-Grammar basics