164k views
3 votes
If there is an int/integer in a array, and the same int/integer comes at the same spot, does it cancel each other out or does it reassing the value? (Java)

1 Answer

3 votes

Answer:

The answer to this question is given below in the explanation section.

Step-by-step explanation:

When you use an array in the program, it occupies the memory where to store the data. However, it is noted that the other array cannot store the variable value where the first array has to store its variable value.

however, when you reassign the value their index position of the array, the values are reassigned. But it also depends on the CPU, because sometimes when you release the memory from the array, maybe some other programs get to occupy that location where the first array values were stored.

However, In Java, it is possible that the same int/integer comes at the same spot of the existing integer in an array, then the value at that particular index is reassigned.

User Myk Melez
by
6.1k points