public class Replace2
{
public static void main(String args[])
{
String s1="My name is Sukhvir Kumar";
String s2="I am working in GGI Khanna.";
System.out.println("\nOld String is = " + s1 +"." + s2);
String s3=s1.replace("Kumar","Singh");
String s4=s2.replace("Khanna","Ludhiana");
System.out.println("\nNew String is = " + s3 +"." + s4);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.