I do not understand your answers.
1-What statement gives that exception?
The exception message gives line 97 as the location. What statement is at line 97?2-What is the name of the list?Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 12, Size: 12
at java.util.ArrayList.rangeCheck(ArrayList.java:657)
at java.util.ArrayList.get(ArrayList.java:433)
at it.cliente.Confrontare.confrontaTargheVeicolo(Confrontare.java:97)
Your answer was: cliente.getVeicoloId()
Do you mean that the list returned by that method was used at line 97 with an index containing 12?
3-What is the name of the index variable with the value that is past the end of the list?
You said: clienteIndex
I do NOT see any statement that uses that index with the list from 2
I would expect to see something like this:
cliente.getVeicoloId().get(clienteIndex) //<<<< The list with the index
But I do not see where the index from 3 is used with the list from 2
--- Update ---
I missed this from post#9I see indexes into 2 lists:97: if (cliente.getTarga().get(clienteIndex).equals(veicolo.getTarga().get(veicoloIndex))) {
cliente.getTarga().get(clienteIndex)
veicolo.getTarga().get(veicoloIndex)
What are the values in clienteIndex and veicoloIndex when that statement is executed?
What are the sizes of the lists returned by cliente.getTarga()
and veicolo.getTarga()?
The error message says one of the indexes is 12 and the list it is indexing only has 12 elements. Which ones?
When you find the index with the value 12, then check the code to see how it got that value.