The following code prints eleelde
but I want it to print elcaalde
.
How can I do it? Is there a function like replace char at index()
??
I want to assign the character at i=0
the value of the char at i=6
and print the word elcaalde
.
public class ReverseExperiments3 {
public static void main (String[] args) {
String s= "alcaalde";
s=s.replace('a','e');
System.out.println(s);
}
}