A Java string (from now on just called string) holds a sequence of 0 or more characters. If there are n, then the chars in the string are indexed (numbered) from 0 to n-1 inclusive.
A string instance has various methods, including the following:
Here is a Java function setCharAt with three parameters: a string s, an index i, and a char ch, that replace the char at index iwith the parameter ch, so that setCharAt("abcdef", 1, 'X') returns the string aXcdef. setCharAt method. This static method is inefficient and ought to use the StringBuffer class, but we won't deal with that here.