String originalString = "Hello World";
String replacedString = originalString.replace('o', '0');
System.out.println(replacedString); // Output: Hell0 W0rld
StringBuilder stringBuilder = new StringBuilder("Hello World");
stringBuilder.replace(4, 5, "0");
System.out.println(stringBuilder.toString()); // Output: Hell0 World
String originalString = "Hello World";
String replacedString = originalString.replaceAll("o", "0");
System.out.println(replacedString); // Output: Hell0 W0rld
String originalString = "Hello World";
String replacedString = originalString.replaceFirst("o", "0");
System.out.println(replacedString); // Output: Hell0 World