You cannot access variables like this.
You have to define a List
or an array
int A = 0;
int[] myIntArray = {1,2,3,4,5};
for (int i = 0; i < myIntArray.length; i++){
//Now you can access your array with the index
A = myIntArray[i]; //This statement still does not make much sense
}
You should read some java beginner tutorials like this one
1
solved Access B”i” variable inside loop