Java - Write code to remove Char from string

Requirements

Write code to remove Char from string

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String s = "book2s.com";
        char c = 'o';
        System.out.println(removeChar(s, c));
    }/*w w  w  . j  a  va 2s .c  om*/

    public static String removeChar(String s, char c) {
        StringBuffer r = new StringBuffer("");
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != c)
                r.append(s.charAt(i));
        }
        return r.toString();
    }
}