8.1 The tables

Welcome to this new chapter on tables, in programming, we speak of a table to designate a set of elements ... of the same type designated by a unique name, each element being identified by an index specifying its position within ... of the table. Like all languages, Java allows to manipulate arrays, arrays are considered as objects. We ... will start by seeing how to declare and then create tables, possibly the: initialize. We will then study how to use them, either at the level of each element or at a global level.Consider this ... declaration:int t[]: It specifies that t is intended to contain the reference to an array of integers. You note that there is no ... dimension in this statement and, for the moment, no value has been attributed to t. This statement is in ... very close to that of the reference to an object'. We create an array as we create an object, ... that is, using the new operator. We specify both the type of elements, as well as their number (dimension of ... array), as in: t = new int[5] // t refers to an array of 5 integers This instruction allocates the necessary location to an array of 5 ... elements of type int and in place the reference in t. The 5 elements are initialized by default (as all ... the fields of an object) to a "null" value (O for an int). We can illustrate the situation by this diagram ... : we will continue our course in the next videos starts the practice so soon