Posted by: sangfroid February 20, 2008
Login in to Rate this Post:
0
?
Here it comes...
package replace;
/**
*
*/
import java.io.*;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String mystring =" ";
System.out.println("Enter the string");
BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) );
try
{
mystring = stdin.readLine();
} catch ( IOException e) { };
StringBuffer output =new StringBuffer(' ') ;
for (int i=0;i<mystring.length();i++)
{
if (mystring.charAt(i)!=' ')
output.append("*");
else
output.append(" ");
}
System.out.println(output);
}
}
package replace;
/**
*
*/
import java.io.*;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String mystring =" ";
System.out.println("Enter the string");
BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) );
try
{
mystring = stdin.readLine();
} catch ( IOException e) { };
StringBuffer output =new StringBuffer(' ') ;
for (int i=0;i<mystring.length();i++)
{
if (mystring.charAt(i)!=' ')
output.append("*");
else
output.append(" ");
}
System.out.println(output);
}
}