Possiamo rappresentare l'array in questo modo, come un contenitore formato da più posizioni, ogni posizione identificata da un numero che parte da 0,per utilizzare un array si parte obbligatoriamente da 0 e no può mai essere vuoto, possiamo utilizzare l'array quando abbiamo grandi quantità di dati da gestire.
Purtroppo i limiti degli array statici stanno proprio qui, una volta che noi inseriamo la grande non può più essere modificata, e questo può essere un problema quando durante la scrittura del codice abbiamo qualche imprevisto, inoltre per l'uso dell'array dinamico, dobbiamo inserire ogni volta che vogliamo inserire qualcosa la posizione dell'array.
passiamo alla dimostrazione di un array statico.
per la dimostrazione ho proceduto alla creazione di un array che contiene numeri, come prima cosa ho messo il tipo di dato, quindi in questo caso int, poi dopo di che ho inserito la grandezza dell'array...in questo caso 10.
Mentre per l'inserimento dei numeri ho dovuto inserire manualmente la posizione ogni qual volta avevo qualcosa da aggiungere.
int[] contentoreNumeri = new int[10];
Continuiamo con l'array dinamico, questo array è molto utile se siete esperti e volete accorciare le vostre tempistiche, poiché a differenza dell'array statico, non va inserita ne la grandezza dell'array ne la poszione...appunto il termine "DINAMICO",creerà tutto in automatico.
Ho proceduto con la creazione anche di un array dinamico, per spiegarvi passo passo le differenze...come già voi notate per la creazione di un array dinamico dobbiamo soltanto indicare la classe dell'array quindi limitiamo le tempistiche e rendiamo tutto più facile.
ogni volta che dobbiamo inserire un qualcosa dell'array basta inserire nome dell'array.add.
int[] contentoreNumeri = new int[10];
contentoreNumeri .remove(posizione);
SCANDIRE=far scorrere un array finché non troverà quello che vi serve.
Qui sopra vi ho inserito come scorrere un array, per prima cosa inseriamo un for, all'interno inseriamo da quale numero partire quindi i=0,dopodiche per quante volte farlo quindi inseriamo la grandezza del nostro array con il nome del nostro array.size() e per ultimo il contatore da aggiornare,e per ultimo all'interno del nostro file eseguiamo l'istruzione che ci serve, IN QUESTO CASO HO FATTO SVUOTARE TUTTO L'ARRAY.
for(int i=0;i<contentoreNumeri.size();i++){
We can represent the array in this way, as a container formed by several positions, each position identified by a number starting from 0,to use an array we must start from 0 and it can never be empty, we can use the array when we have large amounts of data to handle.
Unfortunately, the limitations of static arrays lie right here, once we insert the size it can no longer be changed, and this can be a problem when during the writing of the code we have some unforeseen, also for the use of the dynamic array, we have to insert every time we want to insert something the position of the array.
Let's move on to the demonstration of a static array.
For the demonstration I proceeded to create an array that contains numbers, as first I put the data type, so in this case int, then after that I entered the size of the array...in this case 10.
While for entering the numbers I had to manually enter the position whenever I had something to add.
int[] contentNumbers = new int[10];
Let's continue with the dynamic array, this array is very useful if you are experienced and want to shorten your timelines, because unlike the static array, neither the size of the array nor the position has to be entered...precisely the term "DYNAMIC",it will create everything automatically.
I proceeded with creating a dynamic array as well, to explain step by step the differences...as you already notice for creating a dynamic array we only have to indicate the class of the array so we limit the timing and make everything easier.
every time we need to insert something from the array just enter array name.add.
int[] contentNumbers = new int[10];
contentNumbers .remove(position);
SCANDER=scroll an array until it finds what you need.
Above I have entered you how to scroll an array, first we enter a for, inside we enter which number to start from so i=0,after that how many times to do it then we enter the size of our array with the name of our array.size() and lastly the counter to update,and lastly inside our file we execute the instruction we need, IN THIS CASE I HAVE MADE THE ENTIRE ARRAY UNSPEED.
for(int i=0;i<counterNumbers.size();i++){
@tipu curate
Upvoted 👌 (Mana: 39/49) Liquid rewards.
grazie mille!!
Congratulations @fraaaaa! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 30 posts.
Your next target is to reach 100 upvotes.
Your next target is to reach 600 upvotes.
Your next target is to reach 200 comments.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out the last post from @hivebuzz:
Support the HiveBuzz project. Vote for our proposal!