Java tutorial
public class Main { public static void main(String args[]) throws Exception { String str = "this is a test"; System.out.println(replaceCharAt(str, 0, 'd')); } public static String replaceCharAt(String s, int pos, char c) { StringBuffer buf = new StringBuffer(s); buf.setCharAt(pos, c); return buf.toString(); } } //dhis is a test