Write a method that will remove given character from the string?
Answer / Tanuj Rastogi
public String removeChar(String str, char c) {n StringBuilder sb = new StringBuilder();n for (int i = 0; i < str.length(); i++) {n if (str.charAt(i) != c)n sb.append(str.charAt(i));n }n return sb.toString();n}
| Is This Answer Correct ? | 0 Yes | 0 No |
What is OOP?
I want to run a simple hello world java (HelloWorld.java) program using a batch file. How can i run it and how to construct a batch file.
Can a class be final?
How do you compare objects in java?
What is local variable and instance variable?
How to convert a string to long?
how to print a numbers from 1 to 100 with out using control structures?
What is anagram number?
Difference between method overloading and overriding.
What is number data type?
Which collection is sorted in java?
how come we know the object is no more used in the class?