COMPLETE SOURCE CODE FOR : ReplaceCharacterInASentence.java
*********************************************
public class ReplaceCharacterInASentence
{
public static void main(String[]args)
{
String a="Hellooo Woooorld";
//REPLACE ALL CHARACTER o WITH a
String b=a.replace('o','a');
System.out.println(b);
//REPLACE A CHARACTER
//REPLACE LAST o IN Hellooo WITH a
//IF YOU WANT TO REPLACE A CHARACTER, YOU MUST TAKE WORD
//THAT CONTAIN THE CHARACTER AND MAKE SURE
//THE WORD IS ONLY UNIQUE THAT CAN REPRESENT WORD
//CONTAIN THE CHARACTER
//This is why we take looo instead of ooo because
//ooo also exist in Woooorld
String c=a.replace("looo","looa");
System.out.println(c);
}
}
*********************************************
JUST COMPILE AND EXECUTE IT
*********************************************