This code isn't working. Can you tell me what's wrong and why?
package exer0403e08;
public class EXER0403E08 {
public static void main(String[] args) {
String str= "hello";
System.out.println(str);
char[]strchar = str.toCharArray();
int first;
int last=5;
System.out.println("The reversed is: ");
for (first=1; first<=5; first++){
strchar[first]=strchar[last];
last--;
}
str=String.valueOf(strchar);
str=str.toUpperCase();
System.out.println(str);
}
}
The answer is "OLLO" and i want to make it "OLLEH".