How can I replace all the vowels in s1 with z
public class q3 {
public static void main(String[] args) {
String s1="Hello World";
System.out.println(s1.replace("a,e,i,o,u","z"));
}
}
System.out.println(s1.replaceAll("[aeiou]", "z"));
If you want to make it case insensitive then use
System.out.println(s1.replaceAll( "(?i)[aeiou]", "z" ));