Saurabh Naik wrote:suppose this is mystring = c:\my\you\image.jpg
and I want only image.jpg.
If you want only name of the file, then I suggest don't go for split method, instead use String#subString(int, int0 method, the first parameter is the index of last "\"(
String has a method for this, search
Java Docs) and second param is length of string.
HTH