Vishal Hegde wrote:in StringBuffer s is created as a reference variable,but when invoking the reverse method sb is being used and also for printing sb is being used.
Why do you think that's an error?
And what happened when you tried the code, to confirm your assumptions before posting here?