Only to find a way to succeed, not to find excuses for failure!
Never give up, everything is possible!!!
Basic Java Learning Summary-Basic Syntax 1
A.
identifiers
two.
Key Words
three.
JAVA
underlying data type
3.1. Java Constants
3.2. Java variables
Essentially, a variable is actually a small area of memory, and when a program runs, it's actually in memory, and then it starts running. An. exe file is not run on the hard disk, and the. exe file that you see on your hard disk is nothing more than a file, and when we double-click the. exe file, the entire. exe file is actually placed in memory and the operating system finds the Main method, That is the entrance to the program, and then it starts to execute. Execution of the process, will continue to allocate some areas in memory, the variable in memory is a small area, the variable has two concepts, one is the name of the variable, the other is the value of the variable, that the small area is a name, containing a value, so in the future to access the contents of this small area can be accessed according to the name of the small area. Therefore, the essence of a variable is a small area of memory. In terms of variables, how much storage space should be allocated in memory? Different variable types allocate different sizes of storage space, each of which belongs to a particular data type, declared as a different data type, and it allocates different storage space in memory.
Variable scope: The scope of the variable is only valid for "{}", and it doesn't work if the "{}" is out.
3.3. Classification of Java Variables
3.4. Java local variables and member variables
3.5. Java Data Type Partitioning
Four. Java Data type explanation
4.1
. Boolean
--Boolean type
4.2
.
char--Character Type
The world's words are all in the computer. 0 and 1,unicode are a way of unifying the language of the world's languages, which can be used to connect the words of the world's nations. Unicode encoding is divided into two kinds, one is Utf-8, the other is Utf-16. Java uses the Utf-16, each character occupies 2 bytes, and any country's text in Unicode is accounted for 2 bytes.
4.3
.
integer Type
C language Compiled program Why can not be ported, such as to put the. exe file under Linux is not executable, a very big reason is that the C language defined variables on different operating systems accounted for the size is not the same, declaring an int type of variable, under Windows accounted for 32 bits, But under Linux it is possible to occupy only 16 bits, then it is likely to indicate that the size is different, under Windows to declare a large number, under Linux is likely to overflow. So that's why the C language can't be ported after the compilation is complete.
4.4
.
floating-point types
4.5. Conversion of basic data Types
Type conversion test
1PublicClassTestconvert {2PublicStaticvoidMain (String arg[]) {3int i1 =123;4int i2 =456;5Double D1 = (I1+I2) *1.2;//The system will be converted to a double type operation6Float F1 = (float) ((I1+I2) *1.2);//Need to strengthen the conversion character7BYTE B1 =67;8byte B2 =89;9BYTE B3 = (byte) (B1+B2);//The system is converted to an int operation and requires a cast characterSystem.Out. println (B3);11Double D2 =1e200;12float F2 = (float) D2;//Will generate overflowSystem.Out. println (F2);14float F3 =1.23f;// must add F15 long L1 = ;long L2 = 30000000000l; must be added L17 float f = l1+l2 +F3; // system will be converted to float type calculation 18 Span style= "color: #0000ff;" >long L = (long) F; The cast will shed the fractional part (not rounded) 19 }20}
Five.
operator
5.1.
arithmetic operators (self-plus and decrement operators)
5.2. Logical operators
5.3.
Assignment Operators
5.4.
String Connector
5.5. Expressions
5.6. Three mesh operator
Basic Java Learning Summary-Basic Syntax 1