Originally posted by Stephen Davies:
Am I missing something here, doesn the String class have a replace method?
..or am I way off, and this is not what your trying (are you trying to override the replace Method=?
You're right. String class does have a replace method. Your code looks very neat.
The code that I gave in the OP came from an
SCJP mock exam. I think that question was designed to "purposely" confuse us - making us think that the output would be "cava" but in fact, it is still "java".
The misleading part is this line:
stringReplace(textString);
- which serves no purpose, I would think.