someString[someRandomIdx] = \'g\';
will give me an error.
How do I achieve the above?
If it is of type string then you can't do that because strings are immutable - they cannot be changed once they are set.
To achieve what you desire, you can use a StringBuilder
StringBuilder someString = new StringBuilder("someString");
someString[4] = 'g';
Update
Why use a string, instead of a StringBuilder? For lots of reasons. Here are some I can think of: