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.

Replies

You are reading an archived discussion.

Related Posts

I need information if we can build or there is a sensor which can detect a video going on or a photo being captured. Please everyone out there help me...
Just wondering if anyone's seen this COVINI C6W super spots car. I'm absolutely in love with this car. Does anyone know the engine specs and design parameters of this car?
A serious PHP security flaw has been discovered in PHP. The servers using 32 bit version of PHP can be compromised by passing just a URL. If you are running...
hello everybody, i like some mini project ideas on mechanical field. whatever it is please post it. Both link and post replies are invited
Dear Experts, What are the softwares required for the following exercises... 1. Develop a Simple Web Site with following Features * Drop down menus * Hotspot Links * CSS 2....