Statement: The material used in this column is written by the VIP students of the Kay Academy, who has the right to be anonymous and has the final right to interpret the article; The Edith Academy is designed to promote students to learn from each other on the basis of public notes.
A. Variable
1. The data stored inside can be modified by the logo;
2. Application format: data type name;
Remember that an assignment is an overlay, which overrides the value in it, such as:
Assignment is overwrite = is to overwrite the old value int age=100;
age=90;
age=70;
age=10;
The age end value is age=100 int;
System.out.println (age);
age=90;
System.out.println (age);
age=70;
System.out.println (age);
age=10;
System.out.println (age); 3. Enter a name requirement: The preceding letter is lowercase;
4. Request a storage space for a data type to memory, and then allocate contiguous byte memory for the corresponding byte of the data type.
Two Constant
1. The first time you can set the identifier to point to a data, late can not be modified;
2. Application format: final data type name;
such as: Final int age=100; age=10; The error can not give the constant to the second value final float FF;
ff=10.5f;
final int age=100;
Final float FF;
ff=10.5f;
Final byte a,b,c,d,e,f;
a=65;
b=10;
c=89;
e=100;
f=-120;
3. Constant in the application can not give value, can be used before the value, but remember can only be given once;
4. Enter the name requirement: All capitals must be capitalized;
5. The constant name usually points to a memory address,
Three Note: 1. Either the variable or the constant is just an identifying symbol, which points to a memory address;
2. No matter what the name is, the letter or underscore begins, you can use the end of the number;
3. Within the same region (within a curly brace) the same name cannot be applied;
4. There are also types of values: Some values are not compatible after they are assigned to the data type, and the assignment formats are different;
① integer int;
② decimal Double;
③ ' char;
④ "" String;
⑤true|false Boolean;
⑥float cannot accept decimals because decimals are double types, large data types are not decimal types
⑦long cannot accept the number of long integers in its own range, because all ints are of type int and the int type is up to 2.1 billion;
5. Common data type: Byte int double Boolean.
Variables and constants