forked from badal74/java-codes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion38.java
More file actions
18 lines (14 loc) · 557 Bytes
/
Copy pathQuestion38.java
File metadata and controls
18 lines (14 loc) · 557 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//How to replace string with another string in java Program
public class rep1 {
public static void main(String args[])
{
// Initialising String
String Str = new String("Welcome to geeksforgeeks");
// Using replace to replace characters
System.out.print("After replacing all o with T : ");
System.out.println(Str.replace('o', 'T'));
// Using replace to replace characters
System.out.print("After replacing all e with D : ");
System.out.println(Str.replace('e', 'D'));
}
}