Don’t forget 0 when counting the entries of a list. When you are asking for the length of a List, Array, String,… the program gives you back the amount of values that are in there. But you cannot check position metin[metin.length()]
as it will never be defined, because metin[0]
is already a position.
The last position of your array is metin[metin.length()-1]
, but when you are doing the for
loop until i
is greater or equal than metin.length()
you are asking for one more, which is undefined and hence the error.
0
solved c# “greater than” and “greater than and equal” difference [duplicate]