First, the statement
1.1. Conditional Statement 1.1.1.if statement
Syntax format:
if (expression) { several statements }
1.1.2. Branch statements (switch statements)
1.2. Circular statement 1.2.1for Loop statement
Analyzing result=1! in memory +2! ... +10! The algorithm
1.2.2while Cycle and Do~while cycle
1.2.3break and Continue
Two, array 2.1. Declaration format:
One-dimensional arrays:
Array name of the array element type [];
The array's element type [] array name;
Two-dimensional arrays:
Array of element type array name [];
The array's element type [] array name;
For example:
float boy[];
Char cat[][];
Declare multiple arrays at once:
int [] A, B;
Equivalent to
int a[],b[];
Special attention:
int [] a,b[];
Equivalent to
int a[],b[][];
2.2. Assigning element formats
Array name = new array element type [number of array elements];
For example:
boy= new float [4];
2.3. Use of arrays
If the number of array elements is n, the index of the array is from 0 to n-1
Use of 2.4.length
Array name. length
For a one-dimensional array, it represents the number of elements
For a two-dimensional array, it represents the number of one-dimensional arrays
2.4. Initialization of arrays
Once the array is created, the system defaults to a default value for each element
You can also assign an initial value to each element when declaring an array
Java Basics (ii)-Statements, arrays