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 274 views
1 answer 196 views
2 answers 269 views
1 answer 206 views
1 answer 201 views
...