replace characters with similar-looking symbols: e becomes 3, i becomes 1, l becomes 7, and o becomes 0. Write a program to carry out these replacements with a sample string.
Complete the following code:
public class ReplacementTester
{
public static void main(String[] args)
{
String greeting = "Hello, elite hacker!";
greeting = greeting.replace("e" , "3");
greeting = greeting.replace("i" , "1");
greeting = greeting.replace("l" , "7");
greeting = greeting.replace("o", "0");
// call the replace method four times
System.out.println(modifiedGreeting);
System.out.println("Expected: H3770, 371t3 hack3r!");
}
}
*Edited: code tags fixed.
This post has been edited by pbl: 29 March 2012 - 09:52 PM

New Topic/Question
Reply



MultiQuote




|