8.2 The tables Part-2
Hello all welcome to this new course dedicated to the table we will see how to declare a table, how to initialize ... an array how to display the values of an array so to begin declare normal variable we call regular variable so int ... value equal to 20 to declare a normal variable giving us the type the name and the value we want ... given to our variable on the other hand to declare an array you have to insert the name of the array, on ... will put tab equal e new int tab as we saw in the previous course so the is a ... table statements now between the bell tower we will put the amount we want for our table say that ... here we want 10 element so in our table tab on will have 10 element now to add a value for ... one of the element adds value you simply have to tab between square brackets and put the location we want ... assign a value say for example we will put 2 2 will match the index we want to assign a value ... so equal to 12 so the Dison index 2 we lie the value 12 so we will display this ... tab value to display the value crochet there, we will put the index we want to have the value so 2 ... we will compile our program and there, we have the value to index 2 that we have added here now ... if you wanted to initialize your table during the disclosure you will simply put in braces the values that you ... wanted given to your table we will put for the first index, we will put 1 decimal point the second index ... 40 the fourth we will put 56 and so on and java will automatically calculate the number of element that it ... there is in our table now to display the number of element that it in our table we are going to be very simple ... do table tab.length and the if we start counting 1 2 3 so there are three elements in ... our table we compile our program and there, we have 3 and the 3 corresponds we will go to the next step ... in the next cous I will show you how to display all the values that there are in a table ... See you again