Thanks all of you.
But it wont work if am not sure about the indexes.
String s1 = "I am from UK.";
String s2 = "I am from";
System.out.println(s1 - s2); // output should be -- UK
String s3 = "I am from UK.";
String s4 = "UK";
System.out.println(s3 - s4); // output should be -- I am from
I want some generic way of doing it if possible.
Thanks for your time.