Java identifiers:
1. Consisting of English letters, numbers, _ (underscore) and $, not limited in length. Where the English letter contains uppercase letters (A~Z) and lowercase letters (a~z), numbers contain 0 to 9
2. The first character of an identifier cannot be a number (that is, the identifier cannot begin with a number)
3. Identifiers are case-sensitive
4. Identifiers cannot contain spaces
Java keywords:
The 1.Java keyword is an identifier that is specified by the Java language to have a specific meaning. Java's keywords have special meanings for Java compilers, they are used to represent a data type, or to represent the structure of a program, and the keywords are all made up of lowercase English letters.
The 2.Java keyword is similar to a function word in human language, has a specific meaning and is an essential part of composing a program (equivalent to an article in a human language).
Java Basic data Type (Introduction):
byte-type--byte--8 bit
Short-integer--short--16 bit
Integral type--int--32 bit
Long plastic--long--64 bit
Single-precision floating-point--float--32 bit
Double-precision floating-point--double--64 bit
Character type--char--16 bit
Boolean---boolean--8 bit
Integral type (Byte,short,int,long):
Range (in byte example):
Byte is 8 bits, which is made up of 8 0/1, because the machine is 2 binary, and the first bit is the sign bit (0 for positive number, 1 for negative number), so a byte type data can represent a range of: 27 to 27-1 (that is, 128 to 127, because in Java 0 is a positive number, So the positive maximum value is 127, and the minimum value of the negative number is-128)
Floating-point type (float,double):
Attention:
To add f (or F) after the number when the float data is assigned, the compiler will assume that this is a double class
Correct assignment method: float f1 = 1.3f;
Boolean Type (Boolean):
Also known as a logical type, used to represent a true/False value for a logical decision, only two character constants can be assigned to a Boolean type in Java, that is: true (true) and False (false)
Attention:
Boolean worth default initial value is False
Java binary logic, 1-bit true, 0-bit false
Character type (char):
The Java character type is Unicode encoded, char (character type) is 16 bits, and the character type is not positive or negative, so it can represent 216 numbers
Range: 0 to 216-1 (0~65535)
Example:
Char C1 = ' a ';
char C2 = 12345;
char C3 = ' Medium ';
Note:Char can store one Chinese and can use numeric values (0~65535) to assign a variable to a character type.
Basic data type Conversions (Introduction):
When assigning low-level variables to high-level variables,Java automatically uses an implicit conversion
When the strong turn (display type conversion, assign the advanced variable to a low-level variable) format: (the type to be converted) The value to be converted
such as: int x = (int) 23.89;//At this time X is 23 (strong turn results in missing precision)
②java Basics-identifiers, keywords, and underlying data types