Learning immediately: https://edu.csdn.net/course/play/20589/257761?utm_source=blogtoedu
1. The four kinds declare an array of methods
method 1:
int[] num1 = new int[10]; //使用new运算符声明数组,确定了数组的类型和长度
Method 2:
int[] num2 = { 1, 2, 3, 4, 5 }; //声明数组时直接初始化,但要知道类型、长度和值
Method 3 (error-prone is not recommended):
int[] num3 = new int[4] { 1, 2, 3, 4 }; //要已知数组长度、类型和值
Method 4:
int[] num4 = new int[] { 1, 2, 3, 4 }; //要已知数组长度、类型和值
2. Statement of type string array values to use enclosed in double quotes, each value separated by a comma
string[] strArr = { "hello", "world", "nihao" };
3. If the array index does not exist, there will be subscript out of bounds exception