0
How can I get retrieve array?
3 Réponses
0
You should use name of variable and index. For example:
int[] arr = new int[5];
arr[2] = 13;
a = arr[2];
System.out.print(a);
or you can print value of arr[2] without assigment operator, that is System.out.print(arr[2]).
0
If you want to print all values of array you should use loop.
0
example:
public static void main(String[] args){
int[] arr = new int[10];
for (int i = 0; i < 10; i++) {
arr[i] = i * 2;
System.out.println(arr[i]);
}
}