How to remove a specific character from a string in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        String str = "java c c++ c# python rust go";
        String ch = "a";
 
        str = str.replace(ch, "");
 
        System.out.println(str);
    }
}



/*
run:

jv c c++ c# python rust go

*/

 



answered Nov 19, 2022 by avibootz

Related questions

1 answer 180 views
1 answer 116 views
2 answers 153 views
1 answer 117 views
1 answer 133 views
...