We'll now see what an assignment means when used with arrays. To achieve this, it is necessary to come back on our discussion comparing the basic types and the advanced types in Java. Let's assume that we have two variables a and b, of sometimes basic types, for example here a and b are integers, and sometimes advanced types; there we'll suppose that a and b are arrays. What will writing a = b mean in both cases? Here we imagine, for example, that b initially contains 2, and that there, b initially contains a reference to an array. So if I execute an assignment in the case of basic types, I find myself in the situation where a eventually contains the same value as b. It's the same in this case there: if I execute this instruction line, I'll copy in a the same value as b, that is a reference to the same array, in our case. For a basic type, doing this assignment doesn't introduce any particular relation between "a" and "b". For example, if I decide afterwards to modify "a" with an assignment such as this one, this obviously doesn't have any incidence on "b". A different situation arises for arrays containing the referenced object. When I achieve this kind of assignment, it becomes possible to modify the array referenced both by "a" and "b". Which means that if I write here a[0] = 300, b[0] will also have the value 300. So, in the case of basic types, there's a true autonomy between the two objects, the modification of one of the objects has absolutely no incidence on the other one. On the other side, when I do an assignment on objects such as arrays, there'll be a dependency relative to the referenced object. The message here is that, unlike basic types, to do an assignment between two variables of array type creates a dependancy between these two objects. Here, we begin with a situation where we initially have two completely distinct arrays, which are autonomous in memory, so a first variable "a" that contains a reference to the 10-cell array, and a second variable "b" that contains a reference to a second array with 10 cells, initially completely autonmous. So we begin by filling the array "a", simply with a for-loop, by putting in each cell the same values as the indexes. So we end up with this situation in memory; and we execute our much vaunted assignment of "a" into "b". So with this assignment, we'll put in "b" the same address than the one in "a", which means that now on "b" will point to this array. This relation is broken, these memory locations aren't accessible anymore. And here, if I modify the third entry of the array via "a", I see that the same array's entry accessed via "b" is also modified. We therefore see that the assignment of two arrays with = only makes sense if we want to have two different names for a same array, which is relatevly rare. In the most general case, with an assignment we want to ensure that each cell of the array "b" is put in corresponding cells of the array "a", while ensuring that both array keeps their autonomy. For such a situationt, it is better to proceed with a loop, which will allow us to copy each value from the first array's cells to the corresponding cells of the second array, paying attention to stay between the licit bounds! So if, for example, we choose as break condition the size of the array "a", well, in order for this loop to not commit any error, it will be necessary for the size of "b" to be at least equal to the size of "a"; otherwise we'd have to formulate the break condition in a slightly different manner. You can now easily understand that the fact that arrays in Java are manipulated through references also has an impact on the semantic of the '==' comparison operator. If "a" and "b" are two arrays, comparing them with == will, of course, compare the references, and not the content of the arrays. So here I'm in the situation where I have "a", which is an array, so it contains a reference to the array, and same for "b"; so a == b will return true only if the same reference is effectively contained in the two objects "a" and "b"; when they both point to the same memory address, which is obviously the case when I've done an assignment of this kind beforehand. So the == operator applied to arrays doesn't test the equality of the content of the arrays pointed by "a" and "b". If we want to compare the contents, we must, like before for the assignment, proceed with an iteration. So if we rather want to compare the content of the two arrays, we'll have to write a number of instruction lines to test if it's the case or not. We can for example begin by testing if the arrays have the same size; if it's not the case, we are sure that the content isn't the same. We'll usually also take the precaution of comparing the arrays with the special reference, the reserved word "null". "null" is a special value that can be assigned to an array and that indicates that the array doesn't reference anything. We usually take this precaution too. So if the arrays don't reference anything, or if they're of different sizes, then we can immediately say that their content is different. Otherwise, we can suppose that their content is possibly the same, but we'll have to test it, and we'll have to iterate over the entire array and test cell by cell if the content of the two are identic. If we exit the loop because of the first condition, it means that we've iterated over the entire array and that the condition was always true cell by cell, so we can assert that the contents were the same. Otherwise, well we're in the situation where the contents are different. To conclude this presentation about fixed-size arrays in Java, here are a few simple examples of standard routine manipulations, like for example printing the content of an array or inputing the content of an array. We suppose here that we have initially declared a variable "table" that can contain a number of double-type values. We also suppose that, later, the program took care of filling the array with values that we consider as appropriate, for example with assignments of this nature, and we want to print the content of the array. To achieve that, it is necessary to resort to iterations, for-loops, which will allow us to iterate over the entire set of values of an array and print them one by one. The type of for-loop to choose, we saw that there exists two of them, will in fact depend of the situation: will we need to explicit the indexes or not. In the case where it is not necessary to explicit the indexes, we can use a for-loop of type "iteration on a set of values". We saw that for this kind of for-loop, we must declare a variable of the same type as the array's elements. This variable will alternately take the different values of the array and we'll be able to print them simply like this. Contrariwise, if we need to explicit the indexes, then we'll resort to a standard for-loop, and at that moment we have to declare an index that will vary from zero to the array's size. We saw that the array's size is expressed by this particular notation. Knowing that the array's indexes go from zero to size-1, we'll have to take the precaution of stopping just before the array's size, and of course, we'll have to move the index forward while we progress in the array. So at that moment, we can print both the index, as it is explicit, and the corresponding value. Second example, the input of the array's elements with a keyboard interaction. We saw that the range for-loop (iteration on a set of values) doesn't allow us to modify the content of the array. So for this we don't have a choice, it is absolutely essential to explicit the indexes in Java. Here, we'll therefore resort to a standard for-loop, iterating, like before, from zero to the array's size and stopping one index before, to avoid overflow, and at that moment we can input each value of the array separately with a standard keyboard input, as we have already done previously.