如何在Java中声明数组变量?
您可以像声明变量一样声明数组-
int myArray[];
您可以使用new关键字像对象一样创建数组-
myArray = new int[5];
您可以通过使用索引逐一为所有元素分配值来初始化数组-
myArray [0] = 101; myArray [1] = 102;
您可以使用索引值访问数组元素-
System.out.println("The first element of the array is: " + myArray [0]);
System.out.println("The first element of the array is: " + myArray [1]);
Alternatively, you can create and initialize an array using the flower braces ({ }):
Int [] myArray = {10, 20, 30, 40, 50}热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下