lass Main{
static String removeChar(String str, char ch){
String newstr = "";
char c;
for(int i = 0; i < str.length(); i++){
c = str.charAt(i);
if(c != ch){
newstr += c;
}
}
return newstr;
}
public static void main(String[] args){
System.out.println("Removing p from apple");
System.out.println(removeChar("apple", 'p'));
}
}
Removing p from apple
ale