I'm a rookie programmer, and I want to swap every element from this array one step to left, but when I write this code, there is no result, where is the wrong?
char[] S = {'h', 'R', 'i', 'y' , 'a' ,'d'};
char temp;
int j =1;
for(int i = 0 ; i< S.length ; i++){
temp = S[i];
S[i]=S[j];
S[j] = temp;
j++;
}
System.out.println(S[0]);
System.out.println(S[1]);
System.out.println(S[2]);
System.out.println(S[3]);
System.out.println(S[4]);
System.out.println(S[5]);