java replace() in string

class sm7
{
	public static void main(String args[])
	{
		String str1=new String("I like java and python");
		str1=str1.replace("java","tea");
		str1=str1.replace("python","coffee");
		System.out.println(str1);
	}
}

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *