public class Foo{ String bar; String baz; public static void main(String args[]) throws Exception { bar="Hohoooo"; baz="Hohoooo"; bar=bar.replace('o','e'); baz=baz.replace('h','H'); System.out.println(bar+" "+baz); } }