1. The String constant uses double quotation marks as the separator of the string.
Format: it can contain numbers, punctuation marks, null, and other special characters,
2. What are the similarities and differences between the print and println methods?
A: Similarities: the print and println methods represent the two services provided by the system. Out object.
Difference: the print cursor will not move to the next line
The println cursor moves to the next line.
3. String concatenation operator?
A: The String concatenation operator is "+ ".
4. Escape sequences are used to indicate special characters that may cause compilation errors.
Escape Sequence in Java
5. variables, assignments, and constants
A: A variable represents the memory unit for storing data. The variable name is the symbolic address of the memory unit.
Eg: int total; // declare an integer variable
Double num1, num2 = 4.356, num3; // declare a Boolean variable
Char letter = 'A', digit = '7'; // declare a character variable
Final int max = 45; // declare a constant integer variable
Value assignment: Reading data does not change its value in memory, but the value assignment statement overwrites the old data.
Constant: a specific value is saved during existence.
Reserved word of a constant: Final
Variable name of a constant: All values must be in uppercase.
// Declare a constant integer variable and assign 27 values to the variable
Eg: Final int max_occupancy = 27;
6. Basic Data Types
Eight basic data types: Four integer types, two floating point types, complex type and boolean type.
Four integer types: byte, short, Int, and long character type: Char. Note: single quotes are used to indicate the character constants such as 'B ',';',''.....
Two floating point types: float and double Boolean: Boolean. Note: The result is only "Turn" or "false ".
Chapter 2 knowledge points