Java basic data type: cannot =null;
Four types of eight types:
Integer type:
BYTE 2 of the 8-time Square
Short 2 of the 16-time Square
int 2 of the 32-time Square
Long 2 of the 64-time Square
Floating point type:
Float
Double
Boolean type:
Boolean (only two values, true, false)
Character type:
Char
String:
String
Type conversions:
Implicit conversions (we don't see the conversion process);
Conditions:
From low-precision to high-precision conversion;
Double 16-bit 1.222222222
↓
Float 8-bit 1.2222222 total eight-bit
Double > Float > Long > int > Short > Byte
An explicit conversion:
Long A = 5;
int L = (int) A; Forced conversions
String manipulation:
String str1 = ""; Reference type
String str = new String ("");
IndexOf (""): the first occurrence of the position, index value
LastIndexOf: Last occurrence of position, index value
CharAt: Index
SUBSTRING (5): Intercept strings from 5 onwards
SUBSTRING (2,4): Starting from 2 to 3, excluding 4
Trim (): Only the front and the last space are removed, the middle is no matter
Replace (', '): Can be a character, can be a string, replace the front one with the back one, the string is ""
ReplaceAll ("", ""):
Equals (): Determines whether two strings are equal (S1,equals (S2));
Split (","): String split
toUpperCase (): Convert uppercase
Flow Control Branch Loop statement
If.....else
If.....else If....else
Switch (value 0) {//value 0 is what type, the following value is what type
Case value 1:
Execute the statement;
Break
Default
Execute the statement;
Break
}
while (condition) {
}do{}while ()
for (initial value; condition judgment; Initial value change) {
}
for (int a: array (int)) {
}
Operator:
Arithmetic operators: +-*/% + +--
Relational operators:> < >= <= = = =!
Logical operator:! & && | | | ^
Bitwise operators:>> << >>> (unsigned Right shift)
Assignment operator: = = = = *=/=%=
String Join Operator: + (in the output, as long as one parameter is a string, the entire output is a string)
Ternary operator: Boolean value 1: Value 2
Getting Started with Java (type conversion, string manipulation, etc.)