I am very new to this and would like a little help. I understand that the for loop has a declaration, a test and an incrementer. What I am trying to do below is print a entered string in reverse.

I keep getting an out of bounds exception because I am reaching 0, the next step being -1.

I just can't seem to work this out. Could someone help please?

This is my code.

for (i=length-1;i<=length;i--)

{

mychar=wordString.charAt(i);

System.out.println(""+mychar);

System.out.println (""+i);

}

My apologies if this is a stupid question
Cheers
Harlequeen