String remove java. Example: Output: 4) Using String's replaceFirst() Method.