Java: replace() by accepting characters dynamically
plz give example on replace() by accepting characters dynamically in Java. Actually i tried following code:
System.out.println("Enter characters to be replaced:");
char s4=(char)System.in.read();
char s5=(char)System.in.read();
System.out.println(s4);
System.out.println(s5);
String r=s1.replace(s4,s5);
System.out.println(r);
But it is not accepting s5 character.
System.out.println("Enter characters to be replaced:");
char s4=(char)System.in.read();
char s5=(char)System.in.read();
System.out.println(s4);
System.out.println(s5);
String r=s1.replace(s4,s5);
System.out.println(r);
But it is not accepting s5 character.
0