① identifiers include: Package name, class name, method name, variable name, constant name, property name
Identifier writing rules: 1, identifiers consist of letters, numbers, _, and $
2, the number cannot be in the starting position
3, cannot repeat with keywords and reserved words
4, Case sensitive
② basic data types include:Numeric, character, Boolean
1, the numerical types are:
Integer type sub -
byte:127 to 128 8 bits (1 bytes); Use only the latter seven digits to represent the first digit table of numbers
The most basic data unit, occupying less space
Short:16 bit (2 bytes) Short integer-32768 to 32767
Int:32 bits (4 bytes) integer plus or minus 2.1 billion write programs mostly in int
long:64 bit (8 bytes) Long integer +-922 16 0 +
Numbers followed by the letter L or lowercase l indicate long data
When you use a number to represent time, you start with a long type and now every
The seconds are increasing.
floating Point Type
Float:32 bit (4 bytes) Single-precision floating-point type
After the data, add F or F to indicate
A description with no F representation is a double type
double:64 bit (8 bytes) Double-precision floating-point type
The default type for decimals can be represented by a number plus D or D.
2, character type: Char
Assignment single quote ', smart with one character
Shaping numbers, representing the encoding and location of characters
Escape character starts with \ \ n line break \ r enter \ t tab
\ \ output back slash \
3, Boolean type: Boolean
True logic True
False logic False
③ variables and Constants
Variable definition mode: Data type variable name;
Data type variable name = value (or defined variable);
Rule: Naming must conform to identifier naming rules
Name do not repeat
Naming makes sense to be easy to understand and read
Constant definition Mode: Final data type constant name;
Final data type constant name = value;
Rule: Only one time can be assigned
Name General ALL Caps
2015/12/30 Java Grammar Learning