mardi 2 août 2016

Is the Object stored in each position of the array in Arrays.fill(Object[], Object) the same object?

I am doing something where I have code like this

Object[] array = new Object[10];
Arrays.fill(array, new Object());

my question is, will array[0] == array[1] be true, or just array[0].equals(array[1])? Or in other words, are all of the values in the array the same exact object or equivalent objects?

Aucun commentaire:

Enregistrer un commentaire