0
hello . in java challenges i tried to reverse my char array but sololearn says my code is not correct dont know why?
2 Respostas
+ 4
for (int i=arr.length-1;i>=0 ;i-- ){…
+ 2
In your for loop it must be
int i = arr.length - 1
because the last index of the char array is not the length of the array but 1 less