8.6 Reference Types and Value Types
Hello everyone welcome to this new course dedicated to the type of reference concerning the tables here we have a ... integer table that contains 5 elements montableau is a reference whereas it means a reference the type ... reference contains a reference or an address has the object by the him-even so in other words the variable here my ... table contains a reference or an address has an array in memory, with the reference types we use a ... reference to control the object in memory we cannot therefore directly access the object so a reference and like ... the address of an object in memory in this case again mounted is a reference to the memory board ... Here, I’m going to another table that I name otherTable that will be equal to my Table so otherTable will have the ... same reference as my Table so they will point to the same object in memory. For a better understanding, I’m going to display ... the items in our two tables, I will use a static method which will allow to display the ... elements of our array in the form of a string this method is the Array.toString which takes as parameter a ... array so in output we have the values our array of the two arrays and as they saw the ... same results, but? I will assign a value to the index 0 therefore otherTable index 0 equal to 1 therefore ... necessarily you have to tell yourself that the first element of other table will change it will be equal to but it ... must also understand that this two tables point to the same object therefore necessarily the two values will change therefore ... index 0 of other values will be equal to 1, but also the index 0 of my Table are equal to ... 1 being given that point to the same object as the result. as I explained the two ... point tables to the same memory object so by modifying one of the tables have modified both tables to ... at the same time I hope you understood this to brief explanation regarding the types of references in the next course ... we will continue on exercises that will allow us to understand this concept-there so see you soon