Kay!
First of all, when dealing with strings you have to refer to their positions in 0 base convention. This means that if you have a string like this:
String str = "hi";
//str length is equal 2 but the character
//'h' is in the position 0 and character 'i' is in the postion 1
With that in mind, the best way to tackle this problem is creating a method to replace a character at a given position in a string like this:
Method:
public String changeCharInPosition(int position, char ch, String str){
char[] charArray = str.toCharArray();
charArray[position] = ch;
return new String(charArray);
}
Then you should call the method 'changeCharInPosition' in this way:
String str = "hi";
str = changeCharInPosition(1, 'k', str);
System.out.print(str); //this will return "hk"
If you have any questions, don't hesitate, post something!